blockTime

blocks the specified date and applies the default 'dimmed' style to it.

void blockTime(Date|number date,array time_points, [object items] );

Deprecated

instead of it, you can use addMarkedTimespan

var spanID = scheduler.addMarkedTimespan({  
    days:  [0,1], 
    zones: "fullday"              
});

Parameters

dateDate|numbera date to block ( if a number is provided, the parameter will be treated as a week
day: '0' index refers to Sunday,'6' - to Saturday )
time_pointsarrayan array [start_minute,end_minute,..,start_minute_N,end_minute_N],
where each pair sets a certain limit range. The array can have any number of such pairs
itemsobjectdefines specific items of view(s) to block

Example

//blocks events from 0 till 8 hours for each Wednesday 
//BUT only for the items with id=1, id=4 in the Units view
scheduler.blockTime(3, [0,8*60], { unit: [1,4] });

Required extension: ext/dhtmlxscheduler_limit.js

Related samples

Details

The method can be called in different ways as in:

//blocks the entire day 3rd May,2009
scheduler.blockTime(new Date(2009,5,3), "fullday");
 
//blocks events from 0 till 10 hours for 3rd June,2009
scheduler.blockTime(new Date(2009,6,3), [0,10*60]);
 
//blocks events from 0 till 8 hours and from 18 till 24 hours for each Saturday
scheduler.blockTime(6, [0,8*60,18*60,24*60]);
 
//blocks all events for each Sunday
scheduler.blockTime(0, "fullday");
 
//blocks events from 0 till 8 hours for each Wednesday
//BUT only for the items with id=1, id=4 in the Units view
scheduler.blockTime(3, [0,8*60], { unit: [1,4] });
 
//makes the same as in examples above, but takes parameters as a config object
scheduler.blockTime({
    days: 3,
    zones: [0,8*60],
    sections: {
        unit: [1,4]
    }
});
Property Description
start_date a Date object that sets the limitation start date
//denies creating events from 3rd May,2012 till 'end_date' 
start_date:new Date(2012,4,3)
end_date a Date object that sets the limitation end date
//denies creating events from 'start_date' till 3rd September,2012
end_date:new Date(2012,8,3)
days days that should be limited
days:[0, 2, 6] //limits Sunday,Tuesday and Saturday
days:"fullweek" //limits the entire week
days:new Date(2012,6,1) //blocks 1st July,2012
zones the period in minutes that should be limited
zones:[4*60,8*60,12*60,15*60] //2 limit blocks:04:00-08:00,12:00-15:00
zones:"fullday" //limits the entire day
css the name of a css class
css:"gray" //draws a DIV and applies the 'gray' css class to it
invert_zones specifies, whether time zones (set by the 'zones' property) must be inverted (default - false)
//results in 2 limitation blocks: 00:00-08:00, 17:00-24:00
zones: [8*60, 17*60], invert_zones: true 
//results in 2 limitation blocks: 00:00-08:00, 17:00-24:00
zones: [0, 8*60, 17*60, 24*60], invert_zones: false
sections allows blocking date(s) just for specific items of specific views.
BTW, the specified date(s) will be blocked just in the related view(s)
//blocks dates  just for the item with the id=5 in the Units view 
//and items with the id=2, id=3 in the Timeline view 
sections: { unit: 5, timeline: [2,3]}
See also
Change log

deprecated since v5.1

Back to top