From 117b28c2e95200d9fb7c2a8bf12a3f930ac83bd3 Mon Sep 17 00:00:00 2001 From: Joyce <26967919+Joyce-O@users.noreply.github.com> Date: Wed, 28 Jan 2026 15:31:30 -0500 Subject: [PATCH] improve timezone discovery --- .../src/components/AvailabilityHeatmap.tsx | 33 ++----------- .../src/components/ParticipantManager.tsx | 47 +++++-------------- frontend/src/pages/Index.tsx | 5 -- 3 files changed, 16 insertions(+), 69 deletions(-) diff --git a/frontend/src/components/AvailabilityHeatmap.tsx b/frontend/src/components/AvailabilityHeatmap.tsx index b6c83d1..399ff88 100644 --- a/frontend/src/components/AvailabilityHeatmap.tsx +++ b/frontend/src/components/AvailabilityHeatmap.tsx @@ -7,7 +7,8 @@ import { } from '@/components/ui/popover'; import { Button } from '@/components/ui/button'; import { Check, X, Loader2 } from 'lucide-react'; -import { TimezoneSelector } from '@/components/TimezoneSelector'; + +const TIMEZONE = 'America/Toronto'; const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']; const hours = [9, 10, 11, 12, 13, 14, 15, 16, 17]; @@ -78,8 +79,6 @@ interface AvailabilityHeatmapProps { onSlotSelect: (slot: TimeSlot) => void; showPartialAvailability?: boolean; isLoading?: boolean; - displayTimezone: string; - onTimezoneChange: (timezone: string) => void; } export const AvailabilityHeatmap = ({ @@ -88,15 +87,13 @@ export const AvailabilityHeatmap = ({ onSlotSelect, showPartialAvailability = false, isLoading = false, - displayTimezone, - onTimezoneChange, }: AvailabilityHeatmapProps) => { - const weekDates = getWeekDates(displayTimezone); + const weekDates = getWeekDates(TIMEZONE); // Find a slot that matches the given display timezone date/hour const getSlot = (dateStr: string, hour: number): TimeSlot | undefined => { // Convert display timezone date/hour to UTC - const targetUTC = toUTCDate(dateStr, hour, displayTimezone); + const targetUTC = toUTCDate(dateStr, hour, TIMEZONE); return slots.find((s) => { const slotDate = new Date(s.start_time); @@ -118,7 +115,7 @@ export const AvailabilityHeatmap = ({ const isSlotTooSoon = (dateStr: string, hour: number) => { // Convert to UTC and compare with current time - const slotTimeUTC = toUTCDate(dateStr, hour, displayTimezone); + const slotTimeUTC = toUTCDate(dateStr, hour, TIMEZONE); const now = new Date(); const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000); return slotTimeUTC < twoHoursFromNow; @@ -177,10 +174,6 @@ export const AvailabilityHeatmap = ({ {selectedParticipants.length} participant{selectedParticipants.length > 1 ? 's' : ''}: {selectedParticipants.map(p => p.name.split(' ')[0]).join(', ')}
-