Merge pull request #223 from kzys/trac-7043

Fixed #7043 - Datepicker: Using multiple months always renders 6 rows of dates even if only 5 are neededf
This commit is contained in:
Scott González 2011-05-11 08:08:37 -07:00
commit d3e21cf59a

View File

@ -1489,7 +1489,7 @@ $.extend(Datepicker.prototype, {
if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate var numRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += '<tr>'; calender += '<tr>';