-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Date Field in Pacific Island timezones show incorrect date #10962
Comments
We will need to test if the new time zone flag fixes this issue or if something more is needed. |
The linked PR has been merged, and we'll be releasing this new timezone feature very soon. Let us know if it addresses your issue here! |
I have tested the new version with timezone field, and can confirm the date is still showing a day early. I'm also using Pacific/Auckland timezone. Tested just payload config change with defaultTimezone: Pacific/Auckland |
We got to the root issue today, we had a fix for dates with no times specifically before but it was accounting only for possible timezones within -12/+12 range. Auckland is in +13 only now due to daylight savings, a unique combination of problems. Will have a PR out to fix this soon! |
Describe the Bug
Hey team, I'm in Auckland NZ and I've run into this bug that is making the Date field very difficult to work with. I'm assuming this might also impact users who might be visiting NZ or other pacific island nations and use the dashboard.
Selecting the date while the users browser is in one of a handful of pacific timezones past UTC+12 or above will cause the following calendar day to be displayed across a few places in the admin UI.
![Image](https://private-user-images.githubusercontent.com/5133959/409356776-c448ae6b-e219-441d-bad8-e40c1cefcc13.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODE1NjEsIm5iZiI6MTczOTQ4MTI2MSwicGF0aCI6Ii81MTMzOTU5LzQwOTM1Njc3Ni1jNDQ4YWU2Yi1lMjE5LTQ0MWQtYmFkOC1lNDBjMWNlZmNjMTMuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMjExNDIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmMxNDdhZTI2ZWIxNDNlNWM3NGYwNTY4ODA4ODNkZmM1OGVmNDAyZTk3ZGYwMWI1NjY5MGNmOGYyNTNiNmQzZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ZUiq-WMSLsJTc6iTQV4SAIA8ds5T-WWmITeLZ21yQd4)
Issue seems to come from the way payload handles date only fields in DatePicker.tsx.
The goal of this code seems to be to set the time object to be midday UTC. While it does do this, when the timezone has an offset of at least +12 (basically everything from New Zealand eastward till the international date line), this will create a corresponding UTC time that will render as 1am or later on the following day when viewed in the dashboard from one of these countries.
Unfortunately there doesn't seem to be a way to pick a standard UTC time that works for both American Samoa and New Zealand at the same time. Changing the offset probably wouldn't be acceptable because there would be existing codebases that expect the specific time of UTC 1200.
Also unfortunately, the onChange override (seen in the code sample above as
onChangeFromProps
) no longer can be set in the payload config because you cannot pass a function to a client component from a server component.Potentially there's a way to make sure the date is handled entirely in UTC and does not get localised to browser timezones when displayed on the dashboard. This is similar to what I'm doing in my frontend for this type of field (I just chop the time component of the UTC string). I think the full fix for this would have to come with a proper overhaul of the date/time system that can handle timezones natively.
Link to the code that reproduces this issue
https://github.com/AndKenneth/date-reproduction
Reproduction Steps
Pacific/Auckland
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: