I've been trying to follow similar posts and the solutions do not seem to work for me. Any help would be appreciated. I'm trying to disable weekends and specific dates. I can't seem to get the beforeShowDay working. In the example below I can get either the weekends or the specific dates disabled by calling either onDate: $.datepick.noWeekends or onDate:nationalDays (respectively)
I'm using jQuery 1.4.4
Datepicker extensions for jQuery v4.0.5
var natDays = [[4, 15],[4, 28] ];
$(function() {
$('#popupDatepicker').datepick();
$('#inlineDatepicker').datepick({
rangeSelect: true,
monthsToShow: 2,
minDate: +1, maxDate: +30,
//onDate: $.datepick.noWeekends,
//onDate:nationalDays,
beforeShowDay:noWeekendsOrHolidays
});
});
function nationalDays(date, inMonth) {
if (inMonth) {
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() + 1 == natDays[i][0] &&
date.getDate() == natDays[i][1]) {
return [0, "disabled"];
}
}
}
return {};
}
function noWeekendsOrHolidays(date) {
var noWeekend = $.datepick.noWeekends(date);
if (noWeekend[0]) {
return nationalDays(date);
} else {
return noWeekend;
}
}