Skip to content

Commit 74b7c3f

Browse files
aparodscottgonzalez
authored andcommitted
Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #7009 - Reformat minDate/maxDate when dateFormat changes.
1 parent f1d939b commit 74b7c3f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ui/jquery.ui.datepicker.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,14 @@ $.extend(Datepicker.prototype, {
444444
this._hideDatepicker();
445445
}
446446
var date = this._getDateDatepicker(target, true);
447+
var minDate = this._getMinMaxDate(inst, 'min');
448+
var maxDate = this._getMinMaxDate(inst, 'max');
447449
extendRemove(inst.settings, settings);
450+
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
451+
if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
452+
inst.settings.minDate = this._formatDate(inst, minDate);
453+
if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
454+
inst.settings.maxDate = this._formatDate(inst, maxDate);
448455
this._attachments($(target), inst);
449456
this._autoSize(inst);
450457
this._setDateDatepicker(target, date);

0 commit comments

Comments
 (0)