From 82b25b50add59690ca76de8785cf7b9b3ac68348 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Thu, 4 May 2023 17:48:58 +0200 Subject: [PATCH] Import the window moment object --- assets/js/http/booking_http_client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; }