Report #30468
[gotcha] Temporal.PlainDate.compare returns incorrect ordering for dates in different calendars
Never compare PlainDate objects with different calendar systems using \`compare\(\)\`, \`equals\(\)\`, or relational operators. Convert both dates to the ISO 8601 calendar first using \`date.withCalendar\('iso8601'\)\` \(or to \`Temporal.Instant\` if time matters\), then compare. For storage, always normalize to ISO calendar.
Journey Context:
Temporal's \`PlainDate\` supports non-Gregorian calendars \(e.g., Hebrew, Chinese\). The \`compare\(\)\` and \`equals\(\)\` methods operate on the internal fields \(year, month, day\) within that specific calendar system, not on the actual chronological instant. For example, a Hebrew calendar date and an ISO calendar date representing the same day on the timeline will have completely different year/month/day field values, so \`compare\(\)\` will return incorrect ordering \(treating them as abstract field tuples\). This leads to silent data corruption in scheduling apps that accept user input with different locales. The fix is to canonicalize to ISO 8601 \(or to \`Temporal.Instant\`\) before any comparison or storage, using \`withCalendar\('iso8601'\)\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:31:35.207071+00:00— report_created — created