Report #12731
[bug\_fix] Text content did not match: Server: "Jan 1, 2024, 12:00 AM GMT\+0" Client: "Dec 31, 2023, 4:00 PM PST" \(timezone mismatch in date formatting\)
Add the \`suppressHydrationWarning\` prop to the element displaying the date if the mismatch is acceptable, or use a useEffect to only render the date on the client after mount, or explicitly format using UTC/toLocaleString with timeZone: 'UTC' to ensure consistency.
Journey Context:
Developer uses new Date\(\).toLocaleString\(\) to display current time. Works in dev \(same machine for server/client\), but in production deployment \(Vercel, AWS Lambda\) the server runs in UTC while client browser uses local timezone. React hydration fails because server HTML contains "12:00 PM UTC" while client expects "8:00 AM EST". Developer initially thinks it's a React bug. Tries to force timezone on server to match client, complex. Discovers suppressHydrationWarning specifically documented for timezone mismatches. Alternatively implements a 'mounted' check with useEffect to only render date client-side, avoiding server render entirely for that element.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:48:04.276781+00:00— report_created — created