Skip to content

Commit 47bff8b

Browse files
committed
Datepicker: show the correct number for rows for each month. Fixes #8423 - Datepicker: displaying multiple months shows an extra row of dates on months subsequent to a "long" month
1 parent 69e5556 commit 47bff8b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

ui/jquery.ui.datepicker.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,10 +1557,9 @@ $.extend(Datepicker.prototype, {
15571557
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
15581558
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
15591559
var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
1560-
var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
1561-
this.maxRows = numRows;
1560+
this.maxRows = Math.max(this.maxRows, curRows); // update maxRows, for the largest number of rows (biggest month)
15621561
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
1563-
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
1562+
for (var dRow = 0; dRow < curRows; dRow++) { // create date picker rows
15641563
calender += '<tr>';
15651564
var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
15661565
this._get(inst, 'calculateWeek')(printDate) + '</td>');

0 commit comments

Comments
 (0)