Closed mmnoo closed 1 year ago
A review app was created for this PR. See https://gmw-users-staging-73479e7.herokuapp.com/
A review app was created for this PR. See https://gmw-users-staging-e7969d7.herokuapp.com/
A review app was created for this PR. See https://gmw-users-staging-f44a9d8.herokuapp.com/
A review app was created for this PR. See https://gmw-users-staging-7c6e122.herokuapp.com/
what's a good way to test this @mmnoo does this change mean that we now have timezone id's?
what's a good way to test this @mmnoo does this change mean that we now have timezone id's?
Sorry bout that. The best way I have figured out is to use the sensors panel in dev tools. Switch the locations. Both for reading the dates and editing them. I also look up what was submitted in postman.
A review app was created for this PR. See https://gmw-users-staging-05a661c.herokuapp.com/
A review app was created for this PR. See https://gmw-users-staging-9ab0103.herokuapp.com/
The review app https://gmw-users-staging-73479e7.herokuapp.com/ was deleted.
The review app https://gmw-users-staging-e7969d7.herokuapp.com/ was deleted.
The review app https://gmw-users-staging-f44a9d8.herokuapp.com/ was deleted.
The review app https://gmw-users-staging-7c6e122.herokuapp.com/ was deleted.
The review app https://gmw-users-staging-05a661c.herokuapp.com/ was deleted.
The review app https://gmw-users-staging-9ab0103.herokuapp.com/ was deleted.
Background: MUI detects a UTC time stamp (or time stamp with no time) and tries to show it in browser local time. So if you look at the same date from Japan or California, it will render as different days. See original ticket for more examples: https://github.com/globalmangrovewatch/gmw-users/issues/298
Big thanks to @ghelobytes for unblocking this!!!! 🎉
There is no way to tell MUI date pickers not to do that and to show the date/time in the original form.Description of hack to make MUI date picker display UTC:Date comes from server in timeless ISO format (yyyy-mm-dd)MUI wants to show that date in local time so removes whatever the offset for the browser timezone is. So the ui adds some fake offset for MUI to feel good about removing, and remaining date is displayed in the ui as the same date on the server.User edits date.User saves form. We need to remove the added offset again so the server gets UTC. Here we also remove the time component from the date.~~Question for devs:
while this code technically works with my dev QA, should we use it? Is it worth the complexity/maintenance/future bug costs?If we proceed, I would update the rest of the dates in the app to behave similarly.