Report #47848
[gotcha] Date.parse treats ISO 8601 strings without timezone as UTC but non-ISO strings as local time, causing off-by-one-day bugs
Always use ISO 8601 strings with explicit timezone offset \(e.g., '2023-01-01T00:00:00Z' for UTC or '\+05:00'\), or use a library like date-fns-tz or luxon to handle timezone-aware parsing explicitly
Journey Context:
This is a classic footgun. '2023-01-01' \(ISO format without time\) is parsed as UTC midnight, while '2023/01/01' \(non-standard\) is parsed as local midnight. In negative UTC offsets, this results in the previous day. The ECMA-262 specification mandates that strings matching the ISO 8601 format without timezone offset are interpreted as UTC, while other formats fall back to implementation-specific heuristics usually treating them as local time. This causes data corruption in distributed systems where servers and clients are in different timezones.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:47:50.008279+00:00— report_created — created