Skip to content
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

[pickers] DatePicker missing onValidDate prop #15951

Closed
david-ic3 opened this issue Jul 27, 2021 · 4 comments
Closed

[pickers] DatePicker missing onValidDate prop #15951

david-ic3 opened this issue Jul 27, 2021 · 4 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@david-ic3
Copy link

david-ic3 commented Jul 27, 2021

When using the DatePicker I'm missing a callback property that will only be called when the date is valid :

  • Manually entered date is a valid date
  • Date is inbounds (min,max), if defined

What i get is, onChange called with invalid dates and dates out of bounds. onAccept is called when a date is clicked in the popper calendar.

The second parameter of onChange is returning the input value (not the pickerSelectionState)

You can check console logs using this demo (demo.tsx)

https://codesandbox.io/s/basicdatepicker-material-demo-forked-izqnh

@david-ic3 david-ic3 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 27, 2021
@eps1lon
Copy link
Member

eps1lon commented Aug 2, 2021

Thanks for the feedback.

Could you elaborate what kind of UI/UX you would like and why you need an onValid callback for that?

@eps1lon eps1lon added new feature New feature or request component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 2, 2021
@david-ic3
Copy link
Author

One scenario. I have a page with a date picker and a table that shows some results based on 'date picker' value. Each time the users selects a new valid date the table will show new results (calculations done in a server).

From a 'date picker component' user point of view I'm only interested on new valid dates to trigger a request to the server. I don't care if the user entered an invalid date or if he is entering a new date manually as I will keep my table with 'old' results.

hope it helps

@eps1lon eps1lon removed the status: waiting for author Issue with insufficient information label Aug 18, 2021
@flaviendelangle flaviendelangle transferred this issue from mui/material-ui Dec 20, 2024
@flaviendelangle
Copy link
Member

On the pickers in @mui/x-date-pickers and @mui/x-date-pickers-pro you can look at the 2nd param of onChange which tells you if the value is valid or not.

@flaviendelangle flaviendelangle changed the title DatePicker missing onValidDate prop [pickers] DatePicker missing onValidDate prop Dec 20, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@david-ic3 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants