Grey out the unavailable dates of the booking flatpickr instance

This commit is contained in:
Alex Tselegidis 2023-02-10 13:38:00 +01:00
parent 7b6565fe32
commit 122759b531
1 changed files with 1 additions and 6 deletions

View File

@ -294,12 +294,7 @@ App.Http.Booking = (function () {
}
// Grey out unavailable dates.
$('#select-date .ui-datepicker-calendar td:not(.ui-datepicker-other-month)').each((index, td) => {
selectedDateMoment.set({date: index + 1});
if (unavailableDates.indexOf(selectedDateMoment.format('YYYY-MM-DD')) !== -1) {
$(td).addClass('ui-datepicker-unselectable ui-state-disabled');
}
});
$('#select-date')[0]._flatpickr.set('disable', unavailableDates.map(unavailableDate => new Date(unavailableDate)));
processingUnavailableDates = false;
}