-
-
Notifications
You must be signed in to change notification settings - Fork 49.7k
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
Add "Boundaries" to RangePicker (do not accept ranges that include disabled dates) #22912
Closed
1 task done
Labels
Comments
Your codesandbox is empty. |
Whoops! Thought it would save automatically. Should be fixed now. |
This comment was marked as off-topic.
This comment was marked as off-topic.
69 tasks
In latest version, // Fake Code Sample
<RangePicker
disabledDate={(date, { from }) => {
if (!from) return false;
if (from < 2024-05-05) {
return date >= 2024-05-05;
}
return date < 2024-05-05;
}}
/> ref demo: https://ant.design/components/date-picker#components-date-picker-demo-select-in-range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What problem does this feature solve?
I'm looking for a way to make sure a whole set of RangePicker inputs don't contain any overlapping dates.
The application asks users to enter, e.g., to list all of their primary residences over the past ten years. The component should be able to impose a restraint like the one below on user input:
AFAICT, this is currently impossible with the RangePicker. Please see the CodeSandbox here for an illustration of the problem: today's date is disabled, but it's perfectly valid to select the range spanning from yesterday until tomorrow.
What does the proposed API look like?
Or perhaps this should just be the default behavior for disabled dates, and you should have to explicitly allow selections that include them?
The text was updated successfully, but these errors were encountered: