Sun
Mon
Tue
Wed
Thu
Fri
Sat
`;
// Add empty cells for days before the first date
const firstDate = dates[0];
const firstDay = firstDate.getDay();
for (let i = 0; i < firstDay; i++) {
calendarHTML += `
`;
}
// Add date cells
dates.forEach(date => {
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const formattedDate = `${day}/${month}/${year}`;
// Check if this is today and disable it if too late in the day
const isToday = date.toDateString() === today.toDateString();
const canBookToday = currentHour < lastBookingHour;
if (isToday && !canBookToday) {
calendarHTML += `
${day}
`;
} else {
calendarHTML += `
${day}
`;
}
});
calendarHTML += `