Skip to content

Commit bb0f73b

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 fe6f27b commit bb0f73b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,10 @@ const helperHebrew: NonIsoHelperBase = ObjectAssign({}, nonIsoHelperBase, {
13491349
} else {
13501350
if (overflow === 'reject') {
13511351
ES.RejectToRange(month, 1, this.monthsInYear({ year }));
1352-
ES.RejectToRange(day, 1, this.maximumMonthLength(calendarDate));
1352+
ES.RejectToRange(day, 1, this.maximumMonthLength({ year, month }));
13531353
} else {
13541354
month = ES.ConstrainToRange(month, 1, this.monthsInYear({ year }));
1355-
day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ ...calendarDate, month }));
1355+
day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ year, month }));
13561356
}
13571357
if (monthCode === undefined) {
13581358
monthCode = this.getMonthCode(year, month);

0 commit comments

Comments
 (0)