nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.4k stars 862 forks source link

Clear calendar #941

Open OlivierMartinez opened 3 years ago

OlivierMartinez commented 3 years ago

It doesn't seem like it's possible to clear/update (via external input) the data visually in the datepicker for both range and days.

Using vue 3 version:

Html

<DatePicker v-model="range"
            mode="date"
            is-range
>
</DatePicker>
...

<button @click="clearDate()">
      clear date
</button>

Vue

  setup() {
   const range = ref({
      start: new Date('2021-08-09'),
      end: new Date('2021-08-19')
    });

    const clearDate = () => {
      range.value.start = null;
      range.value.end = null;
    }

    return {
      clearDate,
      range
    };
  },
monsieurPaon commented 3 years ago

up