Skip to content
7 changes: 5 additions & 2 deletions lib/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1691,8 +1691,11 @@ const makeHelperGregorian = (id: BuiltinCalendarId, originalEras: InputEra[]) =>
eras,
anchorEra,
calendarType: 'solar',
inLeapYear(calendarDate /*, cache */) {
const { year } = this.estimateIsoDate(calendarDate);
inLeapYear(calendarDate /*, cache: OneObjectCache */) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do any of the overriding calendars use the month and day to determine inLeapYear? If not, maybe we could just pass year: number to this method instead of what is effectively calendarDate: { year: number }?

// Calendars that don't override this method use the same months and leap
// years as Gregorian. Once we know the ISO year corresponding to the
// calendar year, we'll know if it's a leap year or not.
const { year } = this.estimateIsoDate({ month: 1, day: 1, year: calendarDate.year });
return isGregorianLeapYear(year);
},
monthsInYear(/* calendarDate */) {
Expand Down