-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
DateField/DateInput off by one w/ optimistic rendering #5578
Comments
I'm sorry, but I don't understand your bug. When I use the DateInput, I see nothing wrong with it. Can you please add a link to a CodeSandbox, and explain precisely the scenario to reproduce the bug? |
I will mock up a code sandbox but in the mean time let me explain a little bit more. When updating a date field that exists in my API using the DateInput component, optimistic rendering is rendering the date as one day less than the actual date the user inputs. So, when the optimistic rendering cleanup occurs, the data provider throws an error, as the API and render differ by one in the date field. If you need more explanation, please let me know. I will work on mocking up a sandbox! |
@fzaninotto here is a sandbox link: https://codesandbox.io/s/autumn-pine-2o2lf Try going to the comments, changing the date of one of the comments, saving, and then look at what the date now says versus what the date you inputted says. This behavior is the unintended behavior that I am trying to explain. This sandbox is not altered at all from the base react admin sandbox. |
@tommymcarver, check this issue #5116 and the solution at the #end |
Is this fixed in later React-Admin versions? I'm using v2.9.4 and ran into this. Adding the timeZone 'UTC' to the options does seem to resolve it for me. If not fixed, it may be worth considering mentioning in the docs. |
What you were expecting:
When PUT/POST (update/create) with DateInput, optimistic rendering renders the date as the same date inputted
What happened instead:
Optimistic Rendering rendered the date off by one (EX: 4/5/2020 -> 4/4/2020) which results in the check to crash and error to pop up
Steps to reproduce:
Use a DateInput and save from an edit/create form a date and look at how optimistic rendering renders the date.
Related code:
Other information:
Environment
The text was updated successfully, but these errors were encountered: