]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Fixed #4536 Datepicker maxDate doesn't take into account column layout
authorKeith Wood <kbwood.au@gmail.com>
Mon, 22 Jun 2009 02:08:19 +0000 (02:08 +0000)
committerKeith Wood <kbwood.au@gmail.com>
Mon, 22 Jun 2009 02:08:19 +0000 (02:08 +0000)
ui/ui.datepicker.js

index f3f00acb31448dbf12801ebe6dada0d9e81b478e..702d5ee8e8b149d0101e0b22db7a29d99ee6610a 100644 (file)
@@ -1296,7 +1296,7 @@ $.extend(Datepicker.prototype, {
                }
                if (maxDate) {
                        var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
-                               maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
+                               maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
                        maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
                        while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                                drawMonth--;
@@ -1554,8 +1554,8 @@ $.extend(Datepicker.prototype, {
        /* Determines if we should allow a "next/prev" month display change. */
        _canAdjustMonth: function(inst, offset, curYear, curMonth) {
                var numMonths = this._getNumberOfMonths(inst);
-               var date = this._daylightSavingAdjust(new Date(
-                       curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
+               var date = this._daylightSavingAdjust(new Date(curYear,
+                       curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
                if (offset < 0)
                        date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
                return this._isInRange(inst, date);