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
DateInput, TimeInput, and DateTimeInput are inconsistent #9623
Comments
Thanks for your report. There are various strategies to store partial dates and time, but none that is completely satisfactory. The current state of date and time inputs in react-admin is the result of a compromise between developer expectations, standards, and ease of use. Consistency between these inputs isn't a goal. That being said, if the documentation isn't clear about the input and output, it needs fixing. So I'm marking this as a documentation issue. Would you like to open a PR to fix it? |
@Nela62 You're referring to the MUI variant of DateInput. For the browser-specific variant, at the top of the page, the wording is still not clear enough. Would you like to work on a PR to fix this? |
What you were expecting:
These inputs should receive Date or string and publish Date.
What happened instead:
They are inconsistent:
DateInput
receivesstring
and returnsstring
,TimeInput
receivesstring | Date
and returnsDate
DateTimeInput
receivesstring | Date
and returnsDate
Steps to reproduce:
Make a form with a DateTimeInput, change your mind after talking with the UX team and then switch to DateInput. Now the published value switched from a Date object to a string and validation and transformation functions may unexpectedly break.
Other information:
The DateInput does actually receive a Date or a string, but the documentation says it receives a string.
The parse field for DateTimeInput and TimeInput defaults to a date parser that produces a date object. For the DateInput, the parse field is empty by default.
Environment
The text was updated successfully, but these errors were encountered: