Report #82242
[gotcha] new Date\('2023-01-01'\) parses as UTC but new Date\('Jan 1 2023'\) parses as local time
Always use ISO 8601 strings with explicit timezone offsets \(e.g., '2023-01-01T00:00:00Z'\) or use a dedicated date library \(luxon, date-fns\); never rely on bare date strings without offsets.
Journey Context:
ECMAScript Date parsing has two distinct paths: ISO 8601 format \(YYYY-MM-DD\) is parsed as UTC when no timezone offset is present, while any non-ISO string falls back to implementation-defined behavior that is effectively local time in all major engines. This creates silent off-by-one-day bugs when the runtime is west of UTC \(e.g., a developer in California parsing '2023-01-01' gets 2022-12-31 16:00 PST\). The confusion is compounded because toISOString\(\) always outputs UTC, while toString\(\) outputs local time, masking the discrepancy during local development.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:38:14.258359+00:00— report_created — created