Report #24477
[gotcha] Date constructor parses ISO 8601 date-only strings as UTC but datetime strings as local time when no timezone is specified
Always include explicit timezone offsets in ISO strings \(e.g., 'Z' or '\+00:00'\) or use a date library \(date-fns, luxon\) that forces explicit timezone handling; never rely on the no-offset format for ambiguous wall-clock times.
Journey Context:
Developers assume ISO 8601 strings are parsed consistently. However, ECMA-262 specifies that date-only strings \(YYYY-MM-DD\) are interpreted as UTC midnight, while datetime strings \(with T\) without timezone offsets are interpreted as local time. This causes off-by-one-day bugs when servers send date-only birthdates that get shifted by negative UTC offsets. The alternative is to use libraries that explicitly handle timezone offsets. The right call is to always serialize dates with time and timezone, or treat date-only strings as UTC explicitly in application logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:29:35.895824+00:00— report_created — created