Description
Problem
Currently, the date picker does not support validation, i.e., the date picker component itself does not restrict the user from selecting particular dates. Often, date pickers require some constraints, e.g.:
- Can only select weekdays
- Can only select past/future days
- Cannot select days where the restaurant is closed or unavailable for reservation
Currently in taipy, to implement validation, we would do something like:
- Write some text informing the user of which dates are (in)valid
- If the user selects an invalid date, reset the date to a valid date and send a notification
This is cumbersome for the user, as they'd have to trial and error through the dates to discover which dates still have slots for reservation, etc.
Proposed solution
Date pickers could be substantially improved by adding validation -- disallowing the user from selecting invalid dates.
In the following example, the user may not select weekends (weekends are grayed out):
A good way to do this might be by allowing the developer to specify a function which returns true for valid dates, like so: https://mui.com/x/react-date-pickers/validation/#disable-specific-dates
Please see the following link for other possibilities: https://mui.com/x/react-date-pickers/validation/
Thanks!
Standards appliance
We should closely look at RFC5545 that looks like a standard manner for defining events recurrence, therefore we could use that to define recurrent allowed or disallowed time spans.
Acceptance Criteria
- Ensure new code is unit tested, and check code coverage is at least 90%
- Propagate any change on the demos and run all of them to ensure there is no breaking change
- Ensure any change is well documented