diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index bd91030..ab3c474 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -446,11 +446,16 @@ .on('blur.xdsoft', function() { if( options.allowBlank && !$.trim($(this).val()).length ) { $(this).val(null); + datetimepicker.data('xdsoft_datetime').empty(); } else if( !Date.parseDate( $(this).val(), options.format ) ) { $(this).val((new Date()).dateFormat( options.format )); + datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); } - datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); + else ++ { ++ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); + } datetimepicker.trigger('changedatetime.xdsoft'); }); } @@ -508,6 +513,10 @@ datetimepicker.trigger('xchange.xdsoft'); }; + _this.empty = function() { ++ _this.currentTime = null; ++ }; + _this.getCurrentTime = function( dTime) { return _this.currentTime; };