]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Reformat minDate/maxDate when dateFormat changes. Fixes #7009 - Reformat...
authorAdam Parod <mystic414@gmail.com>
Thu, 17 Feb 2011 21:17:40 +0000 (15:17 -0600)
committerScott González <scott.gonzalez@gmail.com>
Mon, 7 Mar 2011 14:34:00 +0000 (09:34 -0500)
ui/jquery.ui.datepicker.js

index c23984530d29184675f08dbcc0fca01982a43b5a..8dd9bf3dc75ae16bdc71bc71b6b3671b8036f70f 100644 (file)
@@ -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);