Report #100959
[gotcha] Date parsing ambiguity: ISO 8601 date-only string interpreted as UTC, date-time string as local time
Always use explicit timezone offset when parsing ISO 8601 strings. For date-only strings, prefer \`new Date\('2024-01-01T00:00:00Z'\)\` or use a library like \`date-fns\`/\`luxon\` that provides consistent parsing. Alternatively, parse manually using \`Date.UTC\` or \`new Date\(year, month-1, day\)\` to avoid implicit timezone.
Journey Context:
The ECMAScript spec says: \`new Date\('2024-01-01'\)\` \(date-only\) is parsed as UTC, while \`new Date\('2024-01-01T00:00:00'\)\` \(date-time without offset\) is parsed as local time. This inconsistency leads to off-by-one-day errors when the local timezone offset is negative \(e.g., UTC-5\). Many developers assume the same string format yields the same result. The spec changed in ES5.1 to make date-only UTC, but date-time local, causing confusion. Best practice: always include timezone offset or use a library.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T15:51:26.974334+00:00— report_created — created