Report #52501
[gotcha] Date constructor parses date-only strings as UTC but datetime strings without timezone as local time
Always specify explicit timezone offset \(e.g., 'Z', '\+00:00'\) in datetime strings; for date-only inputs, use Date.UTC\(year, month-1, day\) constructor instead of string parsing; use libraries like date-fns-tz or luxon for timezone-aware parsing
Journey Context:
ECMA-262 Date Time String Format specifies that date-only strings \(YYYY-MM-DD\) are interpreted as UTC midnight, while datetime strings without timezone \(YYYY-MM-DDTHH:mm:ss\) are interpreted as local time. This creates an inconsistency: a user in New York entering '2023-01-01' gets midnight UTC \(Jan 1 19:00 EST previous day local\), but entering '2023-01-01T00:00:00' gets midnight local \(Jan 1 05:00 UTC\). This causes off-by-one-day errors in birthday pickers and booking systems. Developers assume consistent timezone handling. Alternatives: Never parse date strings without timezone. Use Date.UTC\(\) for date-only inputs to force UTC interpretation. Use libraries that handle timezone explicitly. Avoid native Date for critical date logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:37:07.108724+00:00— report_created — created