Fixed if input is cleared dont apply time

This commit is contained in:
Trent Richardson 2010-09-21 10:41:10 -04:00
parent 564348cd56
commit f49992774e

View file

@ -378,7 +378,7 @@
}; };
var onCloseFunc = function(dateText, inst) { var onCloseFunc = function(dateText, inst) {
if(tp.timeDefined === true) { if(tp.timeDefined === true && input.val() != '') {
tp.updateDateTime(inst, tp); tp.updateDateTime(inst, tp);
} }
if ($.isFunction(opts.onClose)) { if ($.isFunction(opts.onClose)) {
@ -450,6 +450,7 @@
$.datepicker._base_doKeyPress = $.datepicker._doKeyPress; $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
$.datepicker._doKeyPress = function(event) { $.datepicker._doKeyPress = function(event) {
var inst = $.datepicker._getInst(event.target); var inst = $.datepicker._getInst(event.target);
if ($.datepicker._get(inst, 'constrainInput')) { if ($.datepicker._get(inst, 'constrainInput')) {
var dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); var dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
var chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode); var chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
@ -457,6 +458,7 @@
// keyCode == 32 => " " // keyCode == 32 => " "
return event.ctrlKey || (chr < ' ' || !dateChars || dateChars.indexOf(chr) > -1 || event.keyCode == 58 || event.keyCode == 32); return event.ctrlKey || (chr < ' ' || !dateChars || dateChars.indexOf(chr) > -1 || event.keyCode == 58 || event.keyCode == 32);
} }
}; };
//####################################################################################### //#######################################################################################
@ -504,3 +506,4 @@
$.timepicker = new Timepicker(true); // singleton instance $.timepicker = new Timepicker(true); // singleton instance
})(jQuery); })(jQuery);