From: Adam Parod Date: Thu, 17 Feb 2011 21:17:40 +0000 (-0600) Subject: Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #7009 - Reformat... X-Git-Tag: 1.9m5~235^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=18ad8ffb3df0992b2fd241a4602eff5d799dfdc3;p=jquery-ui.git Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #7009 - Reformat minDate/maxDate when dateFormat changes. --- diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index c23984530..8dd9bf3dc 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -444,7 +444,14 @@ $.extend(Datepicker.prototype, { this._hideDatepicker(); } var date = this._getDateDatepicker(target, true); + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); extendRemove(inst.settings, settings); + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided + if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) + inst.settings.minDate = this._formatDate(inst, minDate); + if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) + inst.settings.maxDate = this._formatDate(inst, maxDate); this._attachments($(target), inst); this._autoSize(inst); this._setDateDatepicker(target, date);