Skip to content

Commit 197c7c9

Browse files
committed
Reject PlainYearMonth with different calendar in comparison
1 parent c1ba1f1 commit 197c7c9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/datetime/_compare.ts

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export function compare(a: ComparableDateTimeType, b: ComparableDateTimeType) {
5656
return getConstructor(a).compare(a, b);
5757
}
5858
if (isPlainYearMonth(a) && isPlainYearMonth(b)) {
59+
if (a.calendarId !== b.calendarId) {
60+
throw new Error("Can't compare PlainYearMonth with different calendar");
61+
}
5962
return getConstructor(a).compare(a, b);
6063
}
6164
if (isPlainMonthDay(a) || isPlainMonthDay(b)) {

0 commit comments

Comments
 (0)