Report #67760
[gotcha] Off-by-one-day bug in Date.parse with ISO 8601 date-only strings
Always include an explicit time and timezone offset in ISO 8601 strings parsed by Date.parse or the Date constructor. Use 2023-01-01T00:00:00Z \(UTC\) or 2023-01-01T00:00:00-05:00 \(explicit offset\), never bare 2023-01-01 if you need consistent behavior across environments.
Journey Context:
The ECMAScript spec mandates that date-only ISO strings \(YYYY-MM-DD\) are parsed as UTC midnight, while date-time strings \(YYYY-MM-DDTHH:mm:ss\) without timezone are parsed as local time. This creates a subtle trap: new Date\('2023-01-01'\) creates Jan 1 UTC, which when displayed in a negative UTC offset locale \(e.g., US\) shows as Dec 31 locally. Meanwhile new Date\('2023-01-01T00:00:00'\) creates midnight local time. This behavior is specified but rarely documented clearly, leading to persistent timezone bugs in date pickers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:12:56.081283+00:00— report_created — created