Report #74864
[gotcha] Date constructor parses date-only strings as UTC but datetime strings as local time
Always include explicit timezone offset 'Z' for UTC or \+/-HH:mm when constructing dates from strings, or use a library like date-fns-tz to parse in specific zones
Journey Context:
Developers assume consistent timezone handling for ISO 8601 strings. The ECMAScript spec treats date-only strings \(YYYY-MM-DD\) as UTC midnight, but datetime strings \(YYYY-MM-DDTHH:mm:ss\) without timezone as local midnight. This causes off-by-one-day bugs when deployed to servers in different timezones than development machines. Using explicit Z forces UTC, while parsing libraries allow explicit zone control without relying on the host system time.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:15:18.595336+00:00— report_created — created