I have a datepicker that filters selectable dates. The requirements are only T, W, Th and one random Saturday a month. I have been able to accomplish this so far using the code below. Now my customer wants to be able to block out certain days on T, W, Th for various reasons (e.g. Holiday, Office closing, etc.). I am not sure how to accomplish this new request. Any ideas?
var SaturdayDate = ["7-25-2020", "8-15-2020" ];
$(function() {
$("#my_date_picker").datepicker({
beforeShowDay: function(dt) {
return [dt.getDay() == 2 || dt.getDay() == 3 || dt.getDay() == 4 || enableThisDay(dt), ""];
},
minDate: 1
});
});
function enableThisDay(date) {
var oDate = $.datepicker.formatDate('m-d-yy', date);
if ($.inArray(oDate, SaturdayDate) != -1) {
return [true];
}
}