Report #6158
[gotcha] Date constructor parses ISO strings as UTC but date-time components as local time
Use explicit Z suffix \(UTC\) or timezone offset in strings; for component constructors \(year, month, day\), manually apply timezone offsets or use Date.UTC before constructing.
Journey Context:
The ECMAScript spec treats new Date\('2024-01-01'\) as UTC \(ISO 8601 format without timezone\), but new Date\(2024, 0, 1\) treats components as local timezone. This causes off-by-one-day bugs when servers \(UTC\) parse dates from browsers \(local\) or vice versa. Alternatives like moment/dayjs help but add bundle size; the fix is explicit timezone handling at boundaries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:16:13.556707+00:00— report_created — created