Report #104459
[gotcha] new Date\(string\) parses ISO 8601 dates as UTC but other formats as local time
Always use Date.parse\(\) with explicit timezone offset or use a library like date-fns/luxon. For ISO 8601 strings without timezone \(e.g., '2023-01-01T00:00:00'\), the spec says local time in ES5 but UTC in ES6 — but browser implementations vary. Append 'Z' or '\+00:00' to force UTC.
Journey Context:
The Date constructor's string parsing is notoriously inconsistent. ISO 8601 date-only strings \(no 'T'\) are parsed as UTC. Date-time strings without timezone are supposed to be local time per ES5, but ES6 changed to UTC — and browsers still diverge. For example, new Date\('2023-01-01'\) is UTC, but new Date\('2023-01-01T00:00'\) may be local in some engines. This silent timezone shift causes bugs in date arithmetic, display, and comparison. The only safe approach is to always include a timezone offset or use a library. The ECMAScript spec has acknowledged this inconsistency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-23T20:03:54.962528+00:00— report_created — created