From 122759b5317a62fc4dd6af11ee7e9964e8fd19e3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 10 Feb 2023 13:38:00 +0100 Subject: [PATCH] Grey out the unavailable dates of the booking flatpickr instance --- assets/js/http/booking_http_client.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/assets/js/http/booking_http_client.js b/assets/js/http/booking_http_client.js index afbef477..98ddb8c6 100755 --- a/assets/js/http/booking_http_client.js +++ b/assets/js/http/booking_http_client.js @@ -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; }