Report #104358
[gotcha] new Date\('2024-04-01'\) is UTC midnight, new Date\('2024/04/01'\) is local time — inconsistent parsing
Always include a timezone offset or use an explicit UTC marker: new Date\('2024-04-01T00:00:00Z'\) for UTC, or use a date library \(e.g., date-fns\) that enforces a consistent interpretation.
Journey Context:
The ECMAScript specification treats date-only ISO 8601 strings \(YYYY-MM-DD\) as UTC when no time or timezone is present. Other formats \(like YYYY/MM/DD or MM/DD/YYYY\) fall back to implementation-specific parsing, which most engines resolve as local time. This inconsistency leads to off-by-one-day errors when mixing formats, especially across browser or Node versions. The safest pattern is to always include time and timezone, avoiding date-only strings entirely. Libraries like date-fns, Luxon, or Day.js provide predictable, documented parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-09T20:02:28.231823+00:00— report_created — created