Litepicker
Litepicker copied to clipboard
[multiselect] preMultipleDates get removed when setting options
Describe the bug
When using the setOptions inside a multiselect.select event, preselected get cleared.
To Reproduce Steps to reproduce the behavior:
- Go to https://codepen.io/nyroDev/pen/mdOowPW?editors=1011
- Click on any date in the inline calendar
- See that this date is not selected
Expected behavior preMultipleDates get cleared when calling the setOptions function, so the dates get cleared. It should not be cleared
Additional context
What I'm trying to do is a multiselect picker restricted to only 1 month.
As a far as the user select the first date, I'm settings the options minDate and maxDate to restrict to the month.
I saw that the preMultipleDates is used internally in order to maintain the selected dates before calling the apply buttons.
That's why I logged it before and after the setOptions call
I'll add a feature request to add a function to get these dates too, as it's required in my use case.
As a workaround, here is wher I do for now:
- Save the
preMultipleDatesin a var - Do the
setOptions - Reset the
preMultipleDates - Call
goToDatewithe the given date
Calling goToDate works because it's not causing the show event, only the render call.
Hre is the codePen: https://codepen.io/nyroDev/pen/jOVJwBe?editors=1011
Please not that the exact same issue occur when calling setOptions from the multiselect.deselect.
The preMultipleDates get reseted to the previous value.
Using the reset preMultipleDates/goToDate works too in this case.