Skip to content

Changing DatePicker mode when menu open does not work #860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fleximex opened this issue May 9, 2024 · 0 comments
Closed

Changing DatePicker mode when menu open does not work #860

Fleximex opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Fleximex
Copy link

Fleximex commented May 9, 2024

Describe the bug
When trying to change the mode of the DatePicker while it is opened the behaviour of the DatePicker breaks.

I'm trying to add an 'exclude' mode to my DatePicker. Normally it works in 'range' mode. I want the DatePicker to be able to switch to 'multi-dates' mode while the DatePicker is open. This way I could simulate a sort of exclude mode.

When switching the mode from 'range' to 'multi-dates' the selected date range will switch to the first and last date of the range. Logically, something I can fix. However when selecting a date it will now select an 'invalid date' and show today being selected in the picker.

When switching the mode from 'multi-dates' to 'range' you can't select a date.

When switching modes, but in between closing and opening the DatePicker, the behaviour is normal.

To Reproduce
const isRangeMode = ref(false)
:range="isRangeMode"
:multi-dates="!isRangeMode"

Basic example
https://stackblitz.com/edit/vuepic-vue-datepicker-e4zhgw?file=src%2Fcomponents%2FPlayground.vue

Expected behavior
Being able to select dates or a range after switching modes, while keeping the menu open.

Tested on vue-datepicker v8.5.1

@Jasenkoo Besides my solution (switching DatePicker modes on the fly), maybe you have a different idea for me on how to implement an 'exclude days from selection' mode, when already having a range of dates selected. This is what I'm trying to achieve:
Exclude mode, a single date excluded

@Fleximex Fleximex added awaiting triage The issue is not reviewed by the maintainers bug Something isn't working labels May 9, 2024
@Jasenkoo Jasenkoo removed the awaiting triage The issue is not reviewed by the maintainers label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants