aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Parod <mystic414@gmail.com>2011-02-17 15:17:40 -0600
committerScott González <scott.gonzalez@gmail.com>2011-03-07 09:35:40 -0500
commit12d38b1886b1e4a17d3bd018f028f7fa2b821229 (patch)
tree757adfa65adc1f63d4c0b79d4e7a4e26ea5ba7d6
parent20b010640e837cad1ad7203e02b28b399e328725 (diff)
downloadjquery-ui-12d38b1886b1e4a17d3bd018f028f7fa2b821229.tar.gz
jquery-ui-12d38b1886b1e4a17d3bd018f028f7fa2b821229.zip
Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #7009 - Reformat minDate/maxDate when dateFormat changes.
(cherry picked from commit 74b7c3f684f5d83effcee6d5099c6fffb020fdf9)
-rw-r--r--ui/jquery.ui.datepicker.js7
1 files changed, 7 insertions, 0 deletions
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);