From f49992774e7251c15a656bed394271c923599422 Mon Sep 17 00:00:00 2001 From: Trent Richardson Date: Tue, 21 Sep 2010 10:41:10 -0400 Subject: [PATCH] Fixed if input is cleared dont apply time --- jquery-ui-timepicker-addon.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 7305735..6026788 100755 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -378,7 +378,7 @@ }; var onCloseFunc = function(dateText, inst) { - if(tp.timeDefined === true) { + if(tp.timeDefined === true && input.val() != '') { tp.updateDateTime(inst, tp); } if ($.isFunction(opts.onClose)) { @@ -450,6 +450,7 @@ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress; $.datepicker._doKeyPress = function(event) { var inst = $.datepicker._getInst(event.target); + if ($.datepicker._get(inst, 'constrainInput')) { var dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); var chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode); @@ -457,6 +458,7 @@ // 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 })(jQuery); +