taipy
taipy copied to clipboard
Add validation for date picker
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!
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
Please provide more details.
Please provide more details.
Hi, I've updated the main comment. Thanks
A user asked for it here
Hey @FlorianJacta @jrobinAV, I would like to work on this issue, may I take this if it's required?
What are your thoughts @FabienLelaquais @FredLL-Avaiga ?
I think @namnguyen20999 is already working on this
I think @namnguyen20999 is already working on this
No issues @FredLL-Avaiga @FlorianJacta , if someone is working on this already👍 if not, then kindly assign this to me 👍
This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.
This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity.