Disable list of holidays in Jquery date picker
How to disable a list of holidays using jquery date picker?
var disabledDates = ['08/30/2010', '05/30/2010', '02/14/2011'];
function noWeekendsOrHolidays(date) {
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return disableDays(date);
} else {
return noWeekend;
}
}
function disableDays(date) {
for (var i = 0; i < disabledDates.length; i++) {
if (new Date(disabledDates[i]).toString() == date.toString()) {
return [false];
}
}
return [true];
}
$(.selector).datepicker({minDate: new Date(),beforeShowDay: noWeekendsOrHolidays, changeYear: true ,changeMonth: true});
精彩评论