Report #74452
[gotcha] Date constructor interprets string input as UTC but component input as local time
Always use ISO 8601 strings with explicit timezone offsets \(e.g., "2024-01-01T00:00:00Z"\) for unambiguous parsing, or use Date.UTC\(\) when creating dates from year/month/day components.
Journey Context:
The Date constructor is polymorphic. When called with a single string argument, it delegates to Date.parse, which treats ISO 8601 formatted strings without a timezone offset \(e.g., "2024-01-01"\) as UTC per ECMA-262. However, when called with multiple numeric arguments \(year, month, day...\), they are interpreted as local time components. This asymmetry causes off-by-one-day bugs when a server \(running in UTC\) parses a date-only string differently than a client \(local time\), or when developers assume both forms use the same timezone reference. Using explicit offsets or Date.UTC eliminates the ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:33:50.566253+00:00— report_created — created