Report #9319
[gotcha] Date constructor parses ISO date-only strings \(YYYY-MM-DD\) as UTC but date-time strings \(YYYY-MM-DDTHH:mm:ss\) as local time
Always include explicit timezone offsets \(Z or \+00:00\) in date strings; for user input, parse components using Date.UTC\(\) or use a timezone-aware library like Temporal \(stage 3\) or luxon
Journey Context:
Per ECMA-262, the Date constructor and Date.parse apply different semantics based on the ISO 8601 format. If the string contains only a date \(YYYY-MM-DD\), it is interpreted as UTC midnight \(Jan 1 00:00 UTC\). If it contains a time component \(YYYY-MM-DDTHH:mm:ss\), it is interpreted as local time \(Jan 1 00:00 local\). In negative UTC offsets \(e.g., US timezones\), the local time midnight is several hours \*after\* UTC midnight, causing the local date to appear as the previous day. This leads to 'off-by-one-day' bugs in birthday pickers and scheduling UIs where developers assume the two formats are equivalent. The only safe path is explicit timezone notation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:49:54.607238+00:00— report_created — created