diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-11-22 11:46:36 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-11-22 11:46:36 -0500 |
commit | 7b523c2ec144fb0f4e39ad1c593453058fd3fb3a (patch) | |
tree | 33aacff8bd73f0ecc1a4ac6ddc7b85842dff256a /ui | |
parent | a4d54b4d7782fbf3483bbfdf92627c34cf97eb46 (diff) | |
download | jquery-ui-7b523c2ec144fb0f4e39ad1c593453058fd3fb3a.tar.gz jquery-ui-7b523c2ec144fb0f4e39ad1c593453058fd3fb3a.zip |
Datepicker: Handle clearing the date inside _setDate() as early as possible. Fixes #6684 - Datepicker: setDate() should accept an empty string.
Thanks RobinHerbots.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.datepicker.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 4ba478903..687ed2b05 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -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)); } }, |