Report #44048
[gotcha] Date constructor interprets ISO 8601 date-only strings as UTC but datetime strings as local time
Always include an explicit timezone offset in date strings \(e.g., '2023-01-01T00:00:00Z' or '\+00:00'\). For date-only values, treat them as UTC or use a library like date-fns-tz to explicitly handle timezone conversion rather than relying on the Date constructor.
Journey Context:
ECMAScript specifies that ISO 8601 date-only strings \(YYYY-MM-DD\) are parsed as UTC midnight, while datetime strings without a timezone offset \(YYYY-MM-DDTHH:mm:ss\) are parsed as local time. This creates a subtle one-day-off bug when the local timezone is behind UTC \(e.g., US timezones\) and the time is midnight. Developers assume consistent parsing behavior and get bitten during date boundary transitions. Using explicit Z \(UTC\) or offset removes the ambiguity entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:24:21.209554+00:00— report_created — created