-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Description
It'd be nice to have some more detailed information how constraining should work for regnal years in the Japanese calendar.
- Dates before the start of the era (from SpiderMonkey WIP implementation):
js> Temporal.PlainDate.from({calendar: "japanese", era: "reiwa", eraYear: 1, month: 1, day: 1}).toString()
"2019-05-01[u-ca=japanese]"
js> Temporal.PlainDate.from({calendar: "japanese", era: "reiwa", eraYear: 1, month: 1, day: 1}).era
"reiwa"
js> Temporal.PlainDate.from({calendar: "japanese", era: "reiwa", eraYear: 1, month: 1, day: 1}, {overflow: "reject"}).toString()
typein:1:20 RangeError: calendar field "eraYear" is too large: 1Whereas the spec polyfill changes to the previous era (for both constrain and reject overflow behaviour):
js> Temporal.PlainDate.from({calendar: "japanese", era: "reiwa", eraYear: 1, month: 1, day: 1}).toString()
"2019-01-01[u-ca=japanese]"
js> Temporal.PlainDate.from({calendar: "japanese", era: "reiwa", eraYear: 1, month: 1, day: 1}).era
"heisei"- Dates after the end of the era (from SpiderMonkey WIP implementation):
js> Temporal.PlainDate.from({calendar: "japanese", era: "heisei", eraYear: 100, month: 1, day: 1}).toString()
"2019-04-30[u-ca=japanese]"
js> Temporal.PlainDate.from({calendar: "japanese", era: "heisei", eraYear: 100, month: 1, day: 1}).era
"heisei"
js> Temporal.PlainDate.from({calendar: "japanese", era: "heisei", eraYear: 100, month: 1, day: 1}, {overflow: "reject"}).toString()
typein:1:20 RangeError: calendar field "eraYear" is too large: 100Spec polyfill has (for both constrain and reject overflow behaviour):
js> Temporal.PlainDate.from({calendar: "japanese", era: "heisei", eraYear: 100, month: 1, day: 1}).toString()
"2088-01-01[u-ca=japanese]"
js> Temporal.PlainDate.from({calendar: "japanese", era: "heisei", eraYear: 100, month: 1, day: 1}).era
"reiwa"Questions I've asked myself:
- Does overflow behaviour affect era/eraYear?
- If yes, does
constrainoverflow constrain to the start/end of the era? - If yes, does
rejectoverflow reject dates before/after the era?
Reactions are currently unavailable