Fix SSR/hydration timezone flip in event date and time display #95

Merged
chrisp merged 1 commit from fix/event-schedule-timezone-display into main 2026-06-17 06:09:30 +00:00

1 commit

Author SHA1 Message Date
Chris Parsons
8a9cffd076 Fix SSR/hydration timezone flip in event date and time display
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 4m0s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m26s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
UTC timestamps rendered with date-fns format() or toLocaleTimeString() use the
runtime's local timezone, causing the server (UTC) and client (PDT) to produce
different output. suppressHydrationWarning was hiding the mismatch but the
visual time-flip was still visible on load.

- Add useHasMounted hook (useSyncExternalStore-based, no extra render cycle)
- Gate UTC timestamp formatting behind isMounted in EventSchedule and
  UpcomingCalendarPanel; SSR always renders the stable YYYY-MM-DD eventDate string
- Fix formatEventDate in date-utils.ts (and EventSchedule private copy) to parse
  YYYY-MM-DD as local midnight instead of UTC midnight, fixing the off-by-one day
  bug for UTC-negative users across all callers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 22:47:22 -07:00