From 0e055937eeaaf2a2e60c527951a4c8f8c5666cf3 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Mon, 18 Aug 2025 13:34:30 +0200 Subject: [PATCH] movie calendar fix --- src/components/MovieCalendar.tsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/MovieCalendar.tsx b/src/components/MovieCalendar.tsx index 912e996..dd77602 100644 --- a/src/components/MovieCalendar.tsx +++ b/src/components/MovieCalendar.tsx @@ -42,10 +42,20 @@ export default function MovieCalendar({ isAdmin = false }: CalendarProps) { }; const getScheduleForDate = (date: Date) => { - const dateString = date.toISOString().split('T')[0]; - return schedules.find(schedule => - schedule.date.split('T')[0] === dateString - ); + // Format date as YYYY-MM-DD in local timezone + const dateString = date.getFullYear() + '-' + + String(date.getMonth() + 1).padStart(2, '0') + '-' + + String(date.getDate()).padStart(2, '0'); + + return schedules.find(schedule => { + // Format schedule date as YYYY-MM-DD in local timezone + const scheduleDate = new Date(schedule.date); + const scheduleDateString = scheduleDate.getFullYear() + '-' + + String(scheduleDate.getMonth() + 1).padStart(2, '0') + '-' + + String(scheduleDate.getDate()).padStart(2, '0'); + + return scheduleDateString === dateString; + }); }; const tileContent = ({ date, view }: { date: Date; view: string }) => { @@ -140,7 +150,7 @@ export default function MovieCalendar({ isAdmin = false }: CalendarProps) { value={selectedDate} tileContent={tileContent} tileClassName={tileClassName} - locale="en-US" + locale="en-GB" />