Vuepic / vue3-date-time-picker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
158 stars 13 forks source link

Range picker with autoApply breaks upon clearing input from keyboard #98

Closed nekitk closed 2 years ago

nekitk commented 2 years ago

Describe the bug When trying to clear text input of Datepicker in range mode with autoApply set to true, page breaks with error:

Cannot read properties of null (reading 'length')

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/vue3-date-time-picker-demo-forked-c7ter?file=/src/components/Demo.vue Or create new component elsewhere with this set of props: <Datepicker v-model="date" range text-input auto-apply />
  2. Using keyboard delete all the text from date input (e.g. press Tab and then Backspace/Delete)

Expected behavior Input should become empty and value should be set to null. It works that way when autoApply is set to false or when Datepicker is in single date mode. Clearing input by clicking on 'x' also works without any problem

Screenshots

Video: https://user-images.githubusercontent.com/7345182/153621929-4a5fb0ea-e78a-4703-8597-c6a7ec8510d4.mp4

image

Desktop (please complete the following information):

nekitk commented 2 years ago

Tried different versions in sandbox and it seems like it has broken in version 2.3.6 Version 2.3.5 doesn't break upon clearing input.