You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to add to the demo page one example using both shortcuts and range:
Expected behavior
If the shortcut returns an array of two dates, it should set the range to the returned array.
(Bonus!) If the shortcut returns only one date, then it could behave as if the user clicked on that date on the calendar; i.e. it would select either the start or the end of the range. This way, it would be possible to have a list of "key" dates and let the user click on them to set an arbitrary range between those dates. (When I say "date", please also consider the other types, such as datetime.)
Actual behavior
When the shortcut returns an array, the handleSelectShortcut function does nothing, because it checks if the value is a date before emitting it. In other words, this function does not support ranges.
However, if the shortcut returns a single date (even though the component is in range mode), that function blindly calls emitValue, which will emit the single date instead of the expected array, which will then break code outside of the component.
The text was updated successfully, but these errors were encountered:
Vue2-datepicker version: 3.2.2
Vue version: 2.6.10 (doesn't matter)
Browser: Chrome 78 (doesn't matter)
Steps to reproduce
range
prop.onClick
returning a list of two elements.Reproduction Link or Source Code
It should be reproducible with a code similar to this one (note: untested code snippet):
It would be nice to add to the demo page one example using both shortcuts and range:
Expected behavior
If the shortcut returns an array of two dates, it should set the range to the returned array.
(Bonus!) If the shortcut returns only one date, then it could behave as if the user clicked on that date on the calendar; i.e. it would select either the start or the end of the range. This way, it would be possible to have a list of "key" dates and let the user click on them to set an arbitrary range between those dates. (When I say "date", please also consider the other types, such as datetime.)
Actual behavior
When the shortcut returns an array, the
handleSelectShortcut
function does nothing, because it checks if the value is a date before emitting it. In other words, this function does not support ranges.However, if the shortcut returns a single date (even though the component is in
range
mode), that function blindly calls emitValue, which will emit the single date instead of the expected array, which will then break code outside of the component.The text was updated successfully, but these errors were encountered: