Skip to content
Permalink
Browse files

Datepicker: Corrected automatic parsing of date on keystrokes

  • Loading branch information
Keith Wood
Keith Wood committed Dec 15, 2009
1 parent 0a83921 commit 7c9b782ee1edbee66253dfb82d0baea1c31c5cba
Showing with 15 additions and 12 deletions.
  1. +15 −12 ui/jquery.ui.datepicker.js
@@ -552,18 +552,20 @@ $.extend(Datepicker.prototype, {
/* Synchronise manual entry and field/alternate field. */
_doKeyUp: function(event) {
var inst = $.datepicker._getInst(event.target);
try {
var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
if (inst.input.val() != inst.lastVal) {
try {
var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}
}
catch (event) {
$.datepicker.log(event);
}
}
catch (event) {
$.datepicker.log(event);
}
return true;
},
@@ -1202,7 +1204,8 @@ $.extend(Datepicker.prototype, {
/* Parse existing date and initialise date picker. */
_setDateFromField: function(inst) {
var dateFormat = this._get(inst, 'dateFormat');
var dates = inst.input ? inst.input.val() : null;
inst.lastVal = inst.input ? inst.input.val() : null;
var dates = inst.lastVal;
var date, defaultDate;
date = defaultDate = this._getDefaultDate(inst);
var settings = this._getFormatConfig(inst);

0 comments on commit 7c9b782

Please sign in to comment.
You can’t perform that action at this time.