Report #72008
[gotcha] Date parses ISO string as UTC but component args as local time
Use new Date\('2023-01-01T00:00:00'\) for UTC midnight, or new Date\(Date.UTC\(2023, 0, 1\)\) to force UTC with component args. Never mix the two styles without timezone awareness.
Journey Context:
Date\(string\) parses ISO 8601 strings without timezone offset as UTC per ECMA-262. But Date\(year, month, day\) treats inputs as local timezone. So new Date\('2023-01-01'\) creates Jan 1 00:00 UTC \(displaying as Dec 31 in negative timezones\), while new Date\(2023, 0, 1\) creates Jan 1 00:00 local. This causes off-by-one date bugs when servers serialize dates to ISO strings and clients parse them with the wrong constructor pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:26:51.846271+00:00— report_created — created