diff --git a/frontend/src/components/AvailabilityHeatmapV2.tsx b/frontend/src/components/AvailabilityHeatmapV2.tsx index 9638307..f4c002d 100644 --- a/frontend/src/components/AvailabilityHeatmapV2.tsx +++ b/frontend/src/components/AvailabilityHeatmapV2.tsx @@ -156,6 +156,23 @@ export const AvailabilityHeatmapV2 = ({ }); }; + // Move hooks to top level to avoid conditional hook execution error + const tzOffsetDiff = useMemo(() => { + try { + const now = new Date(); + const p = parseInt(new Intl.DateTimeFormat('en-US', { timeZone: displayTimezone, hour: 'numeric', hour12: false }).format(now)); + const s = parseInt(new Intl.DateTimeFormat('en-US', { timeZone: secondaryTimezone, hour: 'numeric', hour12: false }).format(now)); + let diff = s - p; + if (diff > 12) diff -= 24; + if (diff < -12) diff += 24; + return diff; + } catch { + return 0; + } + }, [displayTimezone, secondaryTimezone]); + + const timeColWidth = showSecondaryTimezone ? "120px" : "80px"; + if (selectedParticipants.length === 0) { return (
+ Configure your calendar preferences. +
- When enabled, shows time slots where only some participants are available. -
- -