Report #68821
[gotcha] Date constructor parses single ISO string as UTC but multi-argument as local time, causing off-by-one-day bugs
Always use explicit timezone markers in ISO strings \(e.g., '2023-01-01T00:00:00Z'\) and avoid the multi-argument constructor \(year, month, day\); use Date.UTC\(\) or libraries like date-fns for arithmetic
Journey Context:
The single-string constructor follows ISO 8601 \(RFC 3339\), treating date-only forms as UTC midnight. The multi-arg constructor treats components as local time. In Americas timezones \(UTC-5 to UTC-8\), this results in the previous day. Developers often mix styles when refactoring, causing silent data corruption in databases stored as midnight UTC. Using \`getTimezoneOffset\(\)\` to compensate is fragile due to DST transitions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:00:00.594228+00:00— report_created — created