Allow empty internal value if options.allowBlank is true

This commit is contained in:
Teemu Pääkkönen 2014-01-08 15:00:46 +02:00
parent 4e1d9cc57e
commit d5d62f2749

View File

@ -446,11 +446,16 @@
.on('blur.xdsoft', function() { .on('blur.xdsoft', function() {
if( options.allowBlank && !$.trim($(this).val()).length ) { if( options.allowBlank && !$.trim($(this).val()).length ) {
$(this).val(null); $(this).val(null);
datetimepicker.data('xdsoft_datetime').empty();
} }
else if( !Date.parseDate( $(this).val(), options.format ) ) { else if( !Date.parseDate( $(this).val(), options.format ) ) {
$(this).val((new Date()).dateFormat( 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'); datetimepicker.trigger('changedatetime.xdsoft');
}); });
} }
@ -508,6 +513,10 @@
datetimepicker.trigger('xchange.xdsoft'); datetimepicker.trigger('xchange.xdsoft');
}; };
_this.empty = function() {
+ _this.currentTime = null;
+ };
_this.getCurrentTime = function( dTime) { _this.getCurrentTime = function( dTime) {
return _this.currentTime; return _this.currentTime;
}; };