Report #10515
[gotcha] Date constructor timezone inconsistency: ISO string parses as UTC but components parse as local time
Always pass ISO 8601 strings with explicit timezones \(e.g., '2023-01-01T00:00:00-05:00'\) or use date libraries like Temporal; never rely on the multi-argument constructor for non-local interpretations
Journey Context:
Developers assume the string constructor behaves like the component constructor or vice versa. The ISO 8601 spec \(ECMA-262\) mandates that date-only strings \(no time\) are parsed as UTC midnight, whereas the component constructor \(year, monthIndex, day\) uses local system time. This causes 'off-by-one' errors when the local timezone is negative \(e.g., US timezones display the previous day\). The alternatives \(using libraries or explicit timezones\) avoid the ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:51:22.492015+00:00— report_created — created