-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Not a huge problem as the chinese calendar is only well-defined between ISO years 1900 and 2100 and implementation-approximated outside that range, as per https://tc39.es/proposal-intl-era-monthcode/#table-calendar-types. But since we are using the implementation's approximation taken from Intl.DateTimeFormat, we should at least not crash when handling dates that are covered by that approximation.
Also not a spec problem, as this is all covered by the implementation-approximated language.
Reproducer:
const calendar = 'chinese';
const a = new Temporal.PlainDate(7252, 12, 31, calendar);
const b = new Temporal.PlainDate(7254, 1, 1, calendar);
a.until(b, { largestUnit: 'years' });This crashes:
file:///.../proposal-temporal/polyfill/lib/calendar.mjs:1929
result[oldMonthString].daysInMonth = oldCalendarDay + 30 - calendarDay;
^
TypeError: Cannot set properties of undefined (setting 'daysInMonth')
I did a bit of digging and it's because of the loop in helperChinese.getMonthList(). For some reason we have not backed all the way up to M01 in year 7253 at the beginning of the loop. I tested that it's not a regression from #3156.
I'm opening this issue so I don't forget to investigate this at some later time.