Report #82942
[gotcha] Date constructor treats ISO 8601 date-only strings as UTC but date-time strings without timezone as local time
Always include an explicit timezone offset \(e.g., 'Z' for UTC or '\+05:00'\) in ISO strings; never rely on the no-timezone format. If parsing user input, use a library like date-fns-tz or Luxon.
Journey Context:
The spec \(ECMA-262\) mandates that strings matching the ISO 8601 calendar date format \(YYYY-MM-DD\) without time are parsed as UTC midnight, while strings with a time component but no zone \(YYYY-MM-DDTHH:mm:ss\) are parsed as local time. This is because the former matches the 'date-only' production and the latter falls through to local-time parsing. Developers often assume both are UTC or both are local, leading to off-by-one-day bugs when the server \(UTC\) renders a date for a client in a negative offset \(e.g., Americas\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:48:33.555578+00:00— report_created — created