Report #57944
[gotcha] Date constructor parses date-only strings as UTC but date-time strings as local time
Always include explicit timezone offset \(e.g., 'Z' or '\+00:00'\) or use a dedicated library like date-fns-tz. Never rely on implicit timezone behavior for date strings.
Journey Context:
Developers assume Date.parse is consistent. The ECMAScript spec mandates that ISO 8601 strings without a time component \(YYYY-MM-DD\) are parsed as UTC midnight, but strings with a time component \(YYYY-MM-DDTHH:mm:ss\) are parsed as local time. This causes off-by-one-day bugs when the local timezone is negative of UTC, or when servers in different zones process the same string. Many developers reach for libraries only after debugging mysterious date shifts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:45:00.852530+00:00— report_created — created