react-multi-date-picker
react-multi-date-picker copied to clipboard
Limit number of selected date ranges
Hello,
I'm using range and multiple props enabled.
Is there some way to limit number of selected date ranges? So, for example, if the maximum number of allowed date ranges is 2, and user selected two ranges and tries to select a new one, the 2nd range should be substituted instead of selecting of 3rd range.
Do you have any idea?
Hello. Have you tried validating the selected dates in the onChange method? You can prevent the selected dates from being set by returning false in the onChange method: https://shahabyazdi.github.io/react-multi-date-picker/validation/#validating-range-of-dates