vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.29k stars 6.93k forks source link

[Bug Report][3.6.8] Date picker with range: Can't select the same date as start/end #19989

Open bulatgab opened 2 weeks ago

bulatgab commented 2 weeks ago

Environment

Vuetify Version: 3.6.8 Last working version: 2.7.1 Vue Version: 3.4.27 Browsers: Firefox 126.0 OS: Mac OS 10.15

Steps to reproduce

We really need the user to be able to pick the same date as the start and the end in the v-date-picker (with multiple="range").

Expected Behavior

The user can click twice on the same date and get [sameDate, sameDate] as a value

Actual Behavior

The date selection is reset on the second click

Reproduction Link

https://play.vuetifyjs.com/#...

bulatgab commented 2 weeks ago

I think it's all about removing the first if here (line 101 in VDatePickerMonth.tsx):

        if (adapter.isSameDay(_value, rangeStart.value)) {
          rangeStart.value = undefined
          model.value = []
          return
        } else if (adapter.isBefore(_value, rangeStart.value)) {
          rangeStop.value = adapter.endOfDay(rangeStart.value)
          rangeStart.value = _value
        } else {
          rangeStop.value = adapter.endOfDay(_value)
        }
bulatgab commented 2 weeks ago

Just to reiterate, the behaviour was correct in Vuetify 2. It was possible to click on the same date twice and choose it as a range.