mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Merge pull request #28 from borc/master
Allow empty internal value if options.allowBlank is true
This commit is contained in:
commit
17e017c688
@ -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;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user