Report #78905
[gotcha] JavaScript Date constructor treats ISO date-only strings as local time but ISO datetime strings without timezone as UTC
Always include explicit timezone offsets \(Z or ±HH:mm\) in ISO 8601 strings. When parsing date-only inputs \(YYYY-MM-DD\), append T00:00:00 and a timezone marker, or use a robust date library \(Luxon, date-fns-tz\) that forces explicit zone handling.
Journey Context:
ECMAScript specifies two parsing paths: an ISO 8601 date-time without timezone offset \(2023-01-01T00:00:00\) is parsed as UTC, while the date-only form \(2023-01-01\) is parsed as local time. This causes silent timezone shifts where new Date\('2023-01-01'\).getTime\(\) differs from new Date\('2023-01-01T00:00:00'\).getTime\(\) by the host offset. Developers often assume both are UTC or both are local, leading to off-by-one-day bugs in scheduling and calendar UIs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:02:07.918279+00:00— report_created — created