shubhadip / vuejs3-datepicker

vue 3 datepicker. supports disabling, highlighting of dates and programmatic access of date.
https://vuejs3-datepicker.netlify.app/
MIT License
69 stars 41 forks source link

open-date does not work. #35

Closed wokung closed 2 years ago

wokung commented 2 years ago

Hey, I have a simple year datepicker with disabled years in the present.

So whenever I open the datepicker, it opens with year 2022 (but disabled). Now I have to press the arrows some time, till I arrive at not disabled years.

Can you please fix that?

shubhadip commented 2 years ago

can you provide code-snippet or sandbox link to replicate the same issue

wokung commented 2 years ago

you can see it here

https://vuejs3-datepicker.netlify.app/

at the "Disabled" example.

When you open the Datepicker, it opens the 2022 February view. You need to go way back before you can choose a date.

Would be better if it opens automatically on the last available date.

wokung commented 2 years ago

setting the property "open-date" does nothing.

wokung commented 2 years ago

`<datepicker placeholder="to" :minimum-view="'year'" :maximum-view="'year'" name="dateTo" @changedYear="handleChangedYear" :prevent-disable-date-selection="true" :disabled-dates="{ from: ((date) => date.setFullYear(date.getFullYear() - 30) && date)(new Date()) }"

`

vs

`<datepicker placeholder="to" :minimum-view="'year'" :maximum-view="'year'" name="dateTo" @changedYear="handleChangedYear" :prevent-disable-date-selection="true" :open-date="new Date(1991, 1, 1)" :disabled-dates="{ from: ((date) => date.setFullYear(date.getFullYear() - 30) && date)(new Date()) }"

`

wokung commented 2 years ago

I made a codesandbox:

https://codesandbox.io/s/vue3-example-forked-8r57v

you can see that if you change or remove open-date, it changes nothing.

shubhadip commented 2 years ago

please check this out : https://codesandbox.io/s/vue3-example-forked-vum1t

wokung commented 2 years ago

Hi,

this is not the desired functionality for open-date. I don't want to set a value initially. It should be able to stay empty. The same behavior here, I already could get with setting the property "value".

It should behave like this:

https://codesandbox.io/s/vue-datepicker-demo-forked-v9b2s?file=/components/Demo.vue

See the first example. The datepicker is initially empty, but if I open it, it starts on 1991.

shubhadip commented 2 years ago

Hi,

this is not the desired functionality for open-date. I don't want to set a value initially. It should be able to stay empty. The same behavior here, I already could get with setting the property "value".

It should behave like this:

https://codesandbox.io/s/vue-datepicker-demo-forked-v9b2s?file=/components/Demo.vue

See the first example. The datepicker is initially empty, but if I open it, it starts on 1991.

https://codesandbox.io/s/vue3-example-forked-vum1t

wokung commented 2 years ago

Thanks