v2-datepicker icon indicating copy to clipboard operation
v2-datepicker copied to clipboard

Can't clear the date once picked

Open mattglover11 opened this issue 7 years ago • 3 comments

I'm trying to clear the date once a user clicks on a clear button to clear all filters for a report but irrespective of what I set the model value to be, the date always remains the same as what was previously picked.

Example:

this.filters.from = null; <-- has no effect on the selected date

What is the correct procedure for resetting the date picker?

mattglover11 avatar Apr 04 '19 05:04 mattglover11

@dwqs - also stuck on how this works - it's not in the documentation by the way. Any help is much appreciated. Thank you.

ghost avatar Sep 11 '19 15:09 ghost

Found this out. To manually trigger reset, we need to use clearDate(). It's just that it's not in the documentation because there's an existing element (part of the datepicker) that resets the value.

Nevertheless, if value is empty, it throws a console error. TypeError: Cannot read property '$emit' of null

ghost avatar Sep 12 '19 01:09 ghost

@mattyglover manually you can clear this by calling clearDate() method.

Example: this is the component- <v2-datepicker-range ref="dateRangePicker"></v2-datepicker-range>

now call this from your function- this.$refs.dateRangePicker.clearDate();

mzlipu avatar Jan 21 '21 12:01 mzlipu