-
Notifications
You must be signed in to change notification settings - Fork 30
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
DateRange still has functioning navigation buttons outside of min/max dates #783
Comments
@rlkeyer the availity-react/packages/date/src/DateRange.js Line 326 in 0896bab
To disable the navigation buttons I believe you just need to pass in availity-react/packages/date/src/DateRange.js Line 313 in 0896bab
Something like datepickerProps = {
minDate: min,
maxDate: max
} should work |
Hey @rlkeyer it looks like this issue is related to what you're describing: react-dates/react-dates#2139 It looks like when we select a month from the dropdown, Then Judging from This lines up with what you said, but instead of us creating our own workaround we can open a PR to them fixing this issue, what do you think? |
🚀 Feature request
Current Behavior
When using the min and max props for DateRange, the user can still click the next and prev month buttons to travel as far forward or backward as they want, even if the dates are greyed out.
Desired Behavior
Would like to see an option whether by default or with a prop where the next and prev month navigation buttons disappear or are disabled when the user reaches the min/max date specified in the min/max props.
Suggested Solution
A possible solution I thought of would be to track the months that are currently being viewed in state and update the state using the onPrevMonthClick and onNextMonthClick props. From here you could pass functions to navNext and navPrev props to decide whether or not to display the navigation buttons. (ex. if the month currently being viewed is the same as the month from the max date, don't display the next button)
This function that could be passed to navNext replaces the next button with an empty div if you have reached the same month as the max date, and otherwise does not change the next button.
Who does this impact? Who is this for?
People using min and max props for DateRange.
Describe alternatives you've considered
Briefly considered trying to add some sort of message or tooltip when the user hovered a date outside the specified range, but decided that would probably still be confusing for a user if they could press the prev nav button and go back without a limit.
The text was updated successfully, but these errors were encountered: