PDA

View Full Version : How to get a range of days disabled ? (disabledDates)



Spirit
14 Sep 2007, 4:10 AM
Hi!

How would you disable one or if possible several ranges of days in datepicker?
Can someone give me an example ?
I know the docs, but how would the reg. exp. would look like for disabling 20.09.07 til 10.10.07 ?

Thx :D

Spirit
17 Sep 2007, 10:36 PM
ok.
There is no other way than adding the days one by one to the array, right ?
I think so, because i see no way to describe a range textual which would be necessary for reg ex.

Thx

evant
17 Sep 2007, 11:49 PM
You could write a helper method that takes in a range, something like (untested):



//Assumes start and end are valid dates
function disableRange(start, end)
{
var out = [];
while (start <= end)
{
out.push(start);
start = start.add(Date.DAY, 1);
}
return out;
}