I use jQuery datepicker for showing users available days and wants to disable and mark red busy days. I use for this beforeShowDay datepicker option:
beforeShowDay: function(date) {
var cssClass = '';
for (var i=0; i < busyStarts.length; i++) {
var busyStart = new Date(busyStarts[i]);
var busyEnd = new Date(busyEnds[i]);
if (date >= busyStart && date <= busyEnd) {
cssClass = 'ui-state-disabled busy_date';
}
}
return [true, cssClass];
}
busyStarts and busyEnds variables are:
But I see this result:
the first days of intervals are not selected. Why? I have condition date >= busyStart
When I looked into debugger:
That's why equal (=) condition didn't work. Start and End dates with time 03:00:00 but date with 00:00:00 and when dates the same date <= at the same day because 00:00:00 < 03:00:00.
Now I ask, WHY? And how to resolve this correct?