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>
7 lines
194 B
TypeScript
7 lines
194 B
TypeScript
import { useSyncExternalStore } from "react";
|
|
|
|
const subscribe = () => () => {};
|
|
|
|
export function useHasMounted(): boolean {
|
|
return useSyncExternalStore(subscribe, () => true, () => false);
|
|
}
|