Import the window moment object

This commit is contained in:
Alex Tselegidis 2023-05-04 17:48:58 +02:00
parent 230f052b9a
commit 82b25b50ad

View file

@ -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,6 +283,7 @@ 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);
getAvailableHours(moment(currentDate).format('YYYY-MM-DD'));