diff --git a/assets/js/http/booking_http_client.js b/assets/js/http/booking_http_client.js index 98ddb8c6..98adcf9c 100755 --- a/assets/js/http/booking_http_client.js +++ b/assets/js/http/booking_http_client.js @@ -22,6 +22,9 @@ App.Http.Booking = (function () { const $availableHours = $('#available-hours'); const $captchaHint = $('#captcha-hint'); const $captchaTitle = $('.captcha-title'); + + const moment = window.moment; + let unavailableDatesBackup; let selectedDateStringBackup; let processingUnavailableDates = false; @@ -280,8 +283,9 @@ App.Http.Booking = (function () { if (setDate && !vars('manage_mode')) { for (let i = 1; i <= numberOfDays; i++) { const currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), i); + if (unavailableDates.indexOf(moment(currentDate).format('YYYY-MM-DD')) === -1) { - $('#select-date')[0]._flatpickr.setDate( currentDate); + $('#select-date')[0]._flatpickr.setDate(currentDate); getAvailableHours(moment(currentDate).format('YYYY-MM-DD')); break; }