Report #14024
[gotcha] Date strings with 'T' parsed as local time but date-only strings parsed as UTC
Always append \`Z\` \(UTC\) or explicit timezone offset \(\`\+00:00\`\) to datetime strings, or parse date-only strings manually. Never mix \`YYYY-MM-DD\` and \`YYYY-MM-DDTHH:mm:ss\` formats expecting consistent timezone handling.
Journey Context:
The ECMAScript Date Time String Format \(ISO 8601 profile\) specifies that date-only strings \(e.g., \`2023-01-01\`\) are parsed as UTC midnight, whereas datetime strings with a \`T\` separator and no explicit timezone \(e.g., \`2023-01-01T00:00:00\`\) are parsed as local time. This leads to off-by-one-day errors in positive UTC offsets \(e.g., UTC\+8\) when developers append \`T00:00:00\` to a date string thinking it represents midnight UTC. Alternatives considered: using libraries like \`date-fns-tz\` or \`Luxon\`, or always using UTC methods \(\`Date.UTC\`, \`toISOString\`\). The robust pattern is to be explicit about timezone designators \(\`Z\` suffix\) and avoid bare datetime strings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:23:19.797407+00:00— report_created — created