Report #52620
[gotcha] Date.parse treats ISO 8601 date-only as UTC but date-time as local time
Always include explicit timezone offset \(Z or ±HH:mm\) in ISO strings; if parsing ambiguous strings, manually construct Date using Date.UTC\(\) or Date constructor with explicit components.
Journey Context:
The ECMAScript Date.parse algorithm follows ISO 8601 with a twist: strings like '2023-01-01' \(date-only\) are parsed as UTC midnight, but '2023-01-01T00:00:00' \(with time\) is parsed as local midnight. This creates silent bugs when slicing ISO strings or receiving backend timestamps. The 'fix' is to never rely on implicit offsets; enforce Z for UTC or explicit offsets. Alternatives like new Date\(string\) have identical behavior, so component constructors or Date.UTC are the only safe parsers for ambiguous input.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:49:09.314696+00:00— report_created — created