Skip to content

Commit

Permalink
Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #…
Browse files Browse the repository at this point in the history
…7009 - Reformat minDate/maxDate when dateFormat changes.
  • Loading branch information
aparod authored and gnarf committed Mar 8, 2011
1 parent 4ad513b commit 18ad8ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/jquery.ui.datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18ad8ff

Please sign in to comment.