Report #103469
[gotcha] new Date\('2024-01-01'\) is parsed as UTC, but new Date\('2024/01/01'\) is parsed as local time
Always pass an explicit timezone in date strings \(e.g. '2024-01-01T00:00:00Z' or use Date.UTC / Temporal\), and never mix ISO-8601 dash separators with slash separators. If parsing user input, prefer a dedicated date library or explicit year/month/day constructor to avoid silent timezone shifts.
Journey Context:
The ECMAScript Date Time String Format treats ISO 8601 strings without a timezone offset as UTC, while non-ISO strings fall back to the implementation-specific parser that usually interprets them as local time. This means two visually similar strings can produce dates hours apart depending on the host timezone. Teams often assume 'YYYY-MM-DD' is 'obviously' local midnight and end up with off-by-one-day bugs, especially around midnight or when the server runs UTC. Using explicit offsets, Date.UTC, or the Temporal API removes the ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:27:18.344090+00:00— report_created — created