Skip to content

Compile with strictNullChecks/strictPropertyInitialization (focus on calendar.ts and ecmascript.ts) #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 11, 2022
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