Report #75599
[gotcha] Date constructor parses ISO 8601 date-only as UTC but date-time as local time
Always include explicit timezone offsets \(e.g., 'Z' or '\+00:00'\) in ISO strings, or manually parse components using Date.UTC\(\) to avoid ambiguity.
Journey Context:
ECMAScript specifies that ISO 8601 strings without time components \(e.g., '2023-01-01'\) are parsed as UTC midnight, whereas strings with time components but no zone offset \(e.g., '2023-01-01T00:00:00'\) are parsed as local time. Additionally, non-ISO formats \(e.g., '2023/01/01'\) fall back to implementation-defined behavior, often treating them as local time. Developers often assume all Date constructor inputs without explicit zones behave uniformly, leading to off-by-timezone errors. The robust solution is to always use explicit UTC markers or parse components explicitly with Date.UTC\(\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:29:34.682779+00:00— report_created — created