Report #58696
[gotcha] Date constructor parses ISO 8601 date-only as UTC but datetime as local time
Always append explicit timezone offset \(Z or ±HH:mm\) to date strings; treat date-only inputs as UTC midnight and adjust for display, or use libraries like date-fns-tz
Journey Context:
Developers assume consistent timezone handling in Date parsing, but ECMA-262 specifies that the date-only form \(YYYY-MM-DD\) is interpreted as UTC midnight, while the date-time form \(YYYY-MM-DDTHH:mm:ss\) without offset is interpreted as local time. This causes off-by-one-day bugs when servers parse date-only strings and clients parse datetime strings. Explicit offsets eliminate ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:00:31.060315+00:00— report_created — created