Report #85333
[gotcha] Date constructor parses date-only strings as UTC but date-time strings as local time
Always include an explicit timezone offset \(e.g., 'Z' or '\+00:00'\) in ISO strings; never pass a bare date like '2024-01-01' to new Date\(\). Use Date.UTC\(\) or explicit libraries like date-fns-tz.
Journey Context:
The ECMAScript spec mandates that strings without a time component are parsed as UTC midnight, while strings with a time but no zone offset are parsed as local time. This causes off-by-one-day bugs in negative UTC offsets and nondeterministic CI failures depending on the runner's timezone. Explicit offsets or UTC constructors eliminate the ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:49:13.190693+00:00— report_created — created