Report #68383
[gotcha] Date constructor parses date-only strings as UTC but date-time strings as local time
Always use explicit ISO 8601 offsets \(Z or \+/-HH:mm\) in date strings. When parsing user input, explicitly append 'T00:00:00' with timezone or use a library like date-fns-tz or Luxon.
Journey Context:
The ECMAScript spec mandates that date-only strings \(YYYY-MM-DD\) are parsed as UTC midnight, while datetime strings without timezone \(YYYY-MM-DDTHH:mm:ss\) are parsed as local time. This creates off-by-one-day bugs for negative UTC offsets \(Americas\) when using new Date\('2023-01-01'\). People often assume both are UTC or both are local. The fix is to never rely on implicit timezone behavior and always specify offsets or use dedicated libraries that handle timezone math correctly, avoiding the native Date parser for user-facing date strings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:16:04.651970+00:00— report_created — created