mathieustan / vue-datepicker

A clean datepicker made with VueJs
https://vue-datepicker.netlify.com/
MIT License
165 stars 47 forks source link

Bug: Error thrown in range-mode when picking one date and "cancelling" the selection #15

Closed kfirba closed 5 years ago

kfirba commented 5 years ago

Hey @mathieustan

There is a bug where I open the datepicker, pick a starting date and then cancel my selection by either pressing the cancel button or simply clicking outside. When doing so I get the following error:

image

vue.common.dev.js?4650:630 [Vue warn]: Error in v-on handler: "TypeError: Cannot convert undefined or null to object"

found in

---> <DatepickerAgenda> at DatePickerAgenda.vue
       <DatePicker> at DatePicker.vue
         <IndexPageFilterTravelDates> at resources/js/components/index-pages/IndexPageFilterTravelDates.vue
           <IndexPageFilters> at resources/js/components/index-pages/IndexPageFilters.vue
             <Root>
warn @ vue.common.dev.js?4650:630
logError @ vue.common.dev.js?4650:1889
globalHandleError @ vue.common.dev.js?4650:1884
handleError @ vue.common.dev.js?4650:1844
invokeWithErrorHandling @ vue.common.dev.js?4650:1867
invoker @ vue.common.dev.js?4650:2184
original._wrapper @ vue.common.dev.js?4650:7537
vue.common.dev.js?4650:1893 TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at VueComponent.isRangeSelected (vue-datepicker.esm.js?bd0e:3622)
    at Watcher.get (vue.common.dev.js?4650:4468)
    at Watcher.evaluate (vue.common.dev.js?4650:4573)
    at VueComponent.computedGetter [as isRangeSelected] (vue.common.dev.js?4650:4822)
    at VueComponent.handleMouseMove (vue-datepicker.esm.js?bd0e:3913)
    at invokeWithErrorHandling (vue.common.dev.js?4650:1859)
    at HTMLDivElement.invoker (vue.common.dev.js?4650:2184)
    at HTMLDivElement.original._wrapper (vue.common.dev.js?4650:7537)

It sometimes happens even without selecting a start date.

mathieustan commented 5 years ago

I think it's the same issue as #13

mathieustan commented 5 years ago

Should be fixed in latest release 0.1.9