generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I think non-Gregorian date arithmentic should throw in roughly the same situations as Gregorian date arithmetic.
A case that differs is in calendars with leap months (chinese, dangi, hebrew). Currently the spec says:
If calendarDate.[[MonthCode]] is a leap month that doesn't exist in the year, then:
i. If overflow is reject, throw a RangeError exception.
But, this is stricter than in Gregorian, which happily allows an ephemeral date to exist so long as it is then moved into a regular month:
// Error:
Temporal.PlainDate.from("2024-02-29").add({ years: 1 }, { overflow: "reject" })
// OK:
Temporal.PlainDate.from("2024-02-29").add({ years: 1, months: 1 }, { overflow: "reject" })
// Error:
Temporal.PlainDate.from("2024-02-29").add({ years: 1, days: 1 }, { overflow: "reject" })
I don't see why LeapYear-M05L-01 + { years: 1, months: 1 } should throw if it doesn't do that in Gregorian.
To fix this, simply remove that one RangeError. The one a few steps later will still trigger if the days are invalid.
Metadata
Metadata
Assignees
Labels
No labels