Report #8371
[gotcha] new Date\('2023-01-01'\) parses as UTC but new Date\('2023-01-01T00:00'\) parses as local time
Always include explicit timezone offsets in date strings \(Z for UTC or \+/-HH:mm\). For user input, use libraries like date-fns-tz or luxon that handle ambiguity explicitly. Never rely on the presence or absence of a time component to determine timezone behavior.
Journey Context:
ECMA-262 specifies that ISO 8601 date-only strings \(YYYY-MM-DD\) are parsed as UTC midnight, but strings with time components lacking an explicit Z are parsed as local time. This creates a 12-24 hour discrepancy depending on the user's timezone \(e.g., a user in UTC-8 sees '2023-01-01' as Jan 1 00:00 UTC, which is Dec 31 16:00 local\). Developers often test in UTC-negative zones where dates appear correct, masking the bug for UTC\+ users.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:18:28.462187+00:00— report_created — created