Merge pull request #28 from borc/master

Allow empty internal value if options.allowBlank is true
This commit is contained in:
Valeriy 2014-01-08 05:25:03 -08:00
commit 17e017c688

View File

@ -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());
}
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;
};