]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Handle clearing the date inside _setDate() as early as possible. Fixes...
authorScott González <scott.gonzalez@gmail.com>
Mon, 22 Nov 2010 16:46:36 +0000 (11:46 -0500)
committerScott González <scott.gonzalez@gmail.com>
Mon, 22 Nov 2010 16:46:36 +0000 (11:46 -0500)
Thanks RobinHerbots.

ui/jquery.ui.datepicker.js

index 4ba4789031262936b8db23b65834d0b6d69dbe9e..687ed2b052a4303eb97467aa503d1acade2501f8 100644 (file)
@@ -1342,7 +1342,10 @@ $.extend(Datepicker.prototype, {
 
        /* Set the date(s) directly. */
        _setDate: function(inst, date, noChange) {
-               var clear = !(date);
+               if ( !date ) {
+                       inst.input.val( "" );
+                       return;
+               }
                var origMonth = inst.selectedMonth;
                var origYear = inst.selectedYear;
                var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
@@ -1353,7 +1356,7 @@ $.extend(Datepicker.prototype, {
                        this._notifyChange(inst);
                this._adjustInstDate(inst);
                if (inst.input) {
-                       inst.input.val(clear ? '' : this._formatDate(inst));
+                       inst.input.val(this._formatDate(inst));
                }
        },