Date Field: Timezone differs between admin panel input, and rest response #726
-
Bug ReportDate provided in Date Field is inconsistant with it's response form provided via Rest API. Propable cause is the timezone difference. Expected BehaviorI provide data via Data Field. The provided date is like 24.05.2022, 10:00 AM. The rest response should be exactly the same. Current BehaviorThe date in response is however : 24.05.2022, 8:00 AM - two hours prior to what I've provided. Possible SolutionCheck the timezone of Admin frontend and adjust the timezone stamp accordingly, or build functionality to adjust timezone of API response via admin. If I understand correctly, at this point the response date is set via server time, which may differ from the timezone of the browser in whicz admin is working. Steps to Reproduce
Detailed DescriptionCurrent Payload version, Latest Chrome browser, UTC+1 timezone. Payload hostedn on Heroku, without the ability to granular control of the timezone of server. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Thanks for reporting this @quornik. We're considering what the configuration settings will be for timezone and what effects it will have for the admin UI and APIs to solve the issue. We'll update again when we have a plan or fix ready. |
Beta Was this translation helpful? Give feedback.
-
Thanks @DanRibbens. If you think about it, the best practice is to adjust the timezone always on frontend, after the dateObject has been received and befere it is displayed, because the user's context should determine the way date is interpreted & displayed. The scenario in which I had a problem with the way it works now, was this particular situation that I did not localize the response date before displaying. In every other situation it works fine. |
Beta Was this translation helpful? Give feedback.
-
Exactly, @quornik. This isn't really a bug per se, rather, it's a potentially useful admin UX enhancement. We're thinking through how to make this happen as Dan said and will report back here once we have more! |
Beta Was this translation helpful? Give feedback.
-
Since we deterimined there isn't anything in Payload to fix I'm moving this to a discussion for others to see. |
Beta Was this translation helpful? Give feedback.
-
Here's a use case that doesn't fit the current setup too well - I'm adding events using payload, however the events I'm adding take place in a different timezone to where I am currently. It seems payload converts my local time to UTC and stores that - it means I have to do some calculating to input the time I want as it would be in my current timezone. I think a possible solution would be to have the ability to select the timezone of the time you are entering, though I'm not sure if |
Beta Was this translation helpful? Give feedback.
-
Chiming in to say I am experiencing issues with this as well. It would be really nice to have the ability to set a specific timezone for the datefield (or a global config for all date fields) to conform to. Maybe there is already a way to do this within the Date field config that isn't clearly documented? |
Beta Was this translation helpful? Give feedback.
Since we deterimined there isn't anything in Payload to fix I'm moving this to a discussion for others to see.