I have a jQuery datepicker on my website, and I have disabled every first and second day (monday and tuesday) of the week. Also I have an array of days which are disabled (this
var vakantie = ["25-12-2018", "26-12-2018", "27-12-2018", "28-12-2018", "29-12-2018", "30-12-2018", "31-12-2018"];
var enableDays = ["24-12-2018"];
$("#datepicker").datepicker({beforeShowDay: function(dt) {
var datestring = $.datepicker.formatDate('dd-mm-yy', dt);
if($.inArray(datestring, enableDays) != -1) {
return [true];
}
else{
return [dt.getDay() == 1 || dt.getDay() == 2 ? false : true && vakantie.indexOf(datestring) == -1 ];
}
}});
jQuery UI Datepicker - Default functionality
Date:
Try this..
$("#datepicker").datepicker({beforeShowDay: function(dt) {
var datestring = $.datepicker.formatDate('dd-mm-yy', dt);
if($.inArray(datestring, enableDays) != -1) {
return [true];
}
else{
return [dt.getDay() == 1 || dt.getDay() == 2 ? false : true && vakantie.indexOf(datestring) == -1 ];
}
}});