Report #14180
[gotcha] Date constructor interprets ISO date-only strings as UTC but date-time strings as local time
Always include explicit timezone offsets \(Z or \+/-HH:MM\) in ISO strings, or use a robust library like date-fns-tz. Never pass bare date strings like '2023-01-01' to the Date constructor in user-facing code.
Journey Context:
The ECMA-262 spec mandates that date-only ISO strings \(YYYY-MM-DD\) are parsed as UTC midnight, while datetime strings \(YYYY-MM-DDTHH:mm:ss\) without offset are parsed as local time. This creates silent off-by-one-day bugs in scheduling UIs when the server returns UTC dates and the client constructs dates assuming local interpretation. Developers often assume ISO 8601 is uniformly handled, leading to timezone-shifted displays.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:50:14.752198+00:00— report_created — created