diff --git a/frontend/src/components/ScheduleModal.tsx b/frontend/src/components/ScheduleModal.tsx index f7dd54b..3d5cd4b 100644 --- a/frontend/src/components/ScheduleModal.tsx +++ b/frontend/src/components/ScheduleModal.tsx @@ -81,16 +81,20 @@ export const ScheduleModal = ({ return `${hour.toString().padStart(2, '0')}:00`; }; - const formatTime = (hour: number, minutes: number) => { - const totalMinutes = hour * 60 + minutes; - const h = Math.floor(totalMinutes / 60) % 24; - const m = totalMinutes % 60; - return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`; - }; + const formatInTZ = (date: Date) => + date.toLocaleTimeString('en-US', { + timeZone: displayTimezone, + hour: '2-digit', + minute: '2-digit', + hour12: false, + }); + + const getStartTimeDisplay = () => formatInTZ(new Date(slot.start_time)); const getEndTime = () => { if (!slot) return ''; - return formatTime(slot.hour, duration); + const start = new Date(slot.start_time); + return formatInTZ(new Date(start.getTime() + duration * 60 * 1000)); }; const formatDate = (dateStr: string) => { @@ -174,7 +178,7 @@ export const ScheduleModal = ({
- {formatHour(slot.hour)} – {getEndTime()} ({getTimezoneAbbrev(displayTimezone)}) + {getStartTimeDisplay()} – {getEndTime()} ({getTimezoneAbbrev(displayTimezone)})