My code excludes dates, assigns a custom class and a title to the date field.
var holidays =[ [2020,06,17,'A Holiday'],[2020,06,18,'Another Holiday'],[2020,06,19,'Some Other Holiday'] ];
function setHolidays(date) {
for (i = 0; i < holidays.length; i++) {
if (date.getFullYear() == holidays[i][0]
&& date.getMonth() == holidays[i][1] - 1
&& date.getDate() == holidays[i][2]) {
return [false, 'holiday', holidays[i][3]];
}
}
return [true, ''];
}
$( ".add_delivery_date").datepicker( {
minDate: 0,
firstDay: 0,
beforeShowDay: setHolidays
} );
I know I can exclude weekends by using
beforeShowDay: $.datepicker.noWeekends
but I am unsure how to add it to the existing code.