You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTk2MzgsIm5iZiI6MTczOTE1OTMzOCwicGF0aCI6Ii81MTMzOTU5LzQwOTM1Njc3Ni1jNDQ4YWU2Yi1lMjE5LTQ0MWQtYmFkOC1lNDBjMWNlZmNjMTMuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMDM0ODU4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDc5MGE0Yzk5MWVlYmYzZWI3MzI5NTkxNzA5NTg0NmFhZDZjZjUyYmNlMWFiOTcwNTc0MDg1ZDYzZmU4MjYxYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.dnEkP1Ao8yINX81xmtn-TkEgnHbX2axZkByEGDpSgIw)
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: