Skip to content

Commit d1c8f04

Browse files
committed
Allow date to be unset by erasing the input
1 parent 6fe42ed commit d1c8f04

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/js/bootstrap-datetimepicker.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,16 @@
488488
} else if (val && val.trim()) {
489489
if (this.date) this.set();
490490
else input.val('');
491+
} else {
492+
if (this.date) {
493+
// unset the date when the input is
494+
// erased
495+
this.$element.trigger({
496+
type: 'changeDate',
497+
date: null,
498+
viewMode: DPGlobal.modes[this.viewMode].clsName
499+
});
500+
}
491501
}
492502
this._resetMaskPos(input);
493503
},

0 commit comments

Comments
 (0)