Skip to content

Commit efe4498

Browse files
committed
Call maximumMonthLength with correct args
`year` might have been mutated in the first line of this method. So it's not OK to pass `calendarDate` to `maximumMonthLength`. Need to pass current year/month values instead.
1 parent d458938 commit efe4498

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polyfill/lib/calendar.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1146,10 +1146,10 @@ const helperHebrew = ObjectAssign({}, nonIsoHelperBase, {
11461146
} else {
11471147
if (overflow === 'reject') {
11481148
ES.RejectToRange(month, 1, this.monthsInYear({ year }));
1149-
ES.RejectToRange(day, 1, this.maximumMonthLength(calendarDate));
1149+
ES.RejectToRange(day, 1, this.maximumMonthLength({ year, month }));
11501150
} else {
11511151
month = ES.ConstrainToRange(month, 1, this.monthsInYear({ year }));
1152-
day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ ...calendarDate, month }));
1152+
day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ year, month }));
11531153
}
11541154
if (monthCode === undefined) {
11551155
monthCode = this.getMonthCode(year, month);

0 commit comments

Comments
 (0)