nhn / tui.date-picker

Component that selects specific date.
https://nhn.github.io/tui.date-picker/latest/
MIT License
94 stars 30 forks source link

set null if empty, feature request #125

Open pmingkr opened 1 year ago

pmingkr commented 1 year ago

Version

cdn latest

Development Environment

Windows, Chrome

Current Behavior

if the input is empty it returns to the previous value.

Expected Behavior

if the input is empty it becomes the null date. or has the option for it.

pmingkr commented 1 year ago

current my solution

var input = /* input for datepicker */;
var tuiDatePicker = new tui.DatePicker(/* args */)
  input.addEventListener(
    "change",
    (ev) => {
      if (input.value === '') {
        tuiDatePicker.setNull();
      }
    },
    true
  );