Date picker not working for my calendar.

Highlighted
Tourist
10 0 1

I am having an issue with the datepicker, hoping someone can help.  

 

Some of the dates I have listed as unavailable are showing up as options on my site and others are not.(shop.TerraReef.com)  2020/11/5 and 2020/11/4 show up.  2020/11/11 does not show up....  (note on the live site I am going to temporarily add Wednesday and Thursdays to the unavailableDays to just cover this week which I am not going to ship on.  

 

var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
var unavailableDates = ["2020/11/5","2020/11/11","2020/11/4","2020/11/11","2020/11/20","2020/11/24","2020/11/25","2020/11/26","2020/11/27","2020/12/11","2020/12/12","2020/12/24","2020/12/25","2020/12/26","2020/12/27","2020/12/31","2021/1/1"]; // yyyy/MM/dd
var unavailableDays = ["Saturday","Monday","Friday","Sunday"];

function unavailable(date) {
ymd = date.getFullYear() + "/" + ("0"+(date.getMonth()+1)).slice(-2) + "/" + ("0"+date.getDate()).slice(-2);
day = new Date(ymd).getDay();
if ($.inArray(ymd, unavailableDates) < 0 && $.inArray(days[day], unavailableDays) < 0) {
return [true, "enabled", "Book Now"];
} else {
return [false,"disabled","Booked Out"];
}
}


$(document).ready( function() {
$(function() {
$("#date").datepicker( {
minDate: +3,
maxDate: '+16',
beforeShowDay: unavailable
} );
});
});

0 Likes