From 7926e3ae4c6d9ef30213766c991297a900ee3efb Mon Sep 17 00:00:00 2001 From: counterweight Date: Sun, 21 Dec 2025 18:10:15 +0100 Subject: [PATCH] Fix timezone issue: display booking slots in UTC - Changed formatTime() to use UTC methods instead of toLocaleTimeString() - Prevents timezone conversion when displaying booking slots - Now admin sets 9-17 and user sees 9-17, regardless of timezone - Fixes 1-hour offset issue when user timezone differs from UTC --- frontend/app/utils/date.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/app/utils/date.ts b/frontend/app/utils/date.ts index dd8f84c..56ebc06 100644 --- a/frontend/app/utils/date.ts +++ b/frontend/app/utils/date.ts @@ -13,15 +13,15 @@ export function formatDate(d: Date): string { } /** - * Format time from ISO string to HH:MM format. + * Format time from ISO string to HH:MM format in UTC. + * Uses UTC to avoid timezone conversion issues when displaying booking slots. */ export function formatTime(isoString: string): string { const d = new Date(isoString); - return d.toLocaleTimeString("en-US", { - hour: "2-digit", - minute: "2-digit", - hour12: false, - }); + // Use UTC methods to avoid timezone conversion + const hours = String(d.getUTCHours()).padStart(2, "0"); + const minutes = String(d.getUTCMinutes()).padStart(2, "0"); + return `${hours}:${minutes}`; } /**