Replies: 2 comments 2 replies
-
|
When you use a date field in the CP, the date you pick is the date in your operating system's timezone. That was the whole reason anything changed. If you have editors spread across the world, they would previously need to know which timezone the application is configured in. Now, when you pick a date, its your date.
That sounds accurate. If your app is configured as UTC, and you are in UTC+1, when you select a date, its your midnight which is 11pm the previous day in UTC. Then when you do
If your team is spread through timezones and you expect to-the-minute entry dates, then your date fields should include times
Their computer timezone would change, and then the dates they pick would be from the new current timezone. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Statamic 6 is storing dates in UTC time. Which is fine, but once you aren't in UTC, things get really complicated. Let me explain.
What the docs say
The upgrade guide suggests to leave your application timezone in UTC - then nothing should change…
As for the docs, so far so good. If I have a date field e.g.
2026-02-10, it should store still store as2026-02-10, with the timezone set to UTC. That's what I would expect.What really happens
For me living in UTC+1, the above absolutely didn't happen. If you have a date field in the CP, you will set it as your local timezone! That means, although everything is set to UTC, a normal date field (without time) will convert to
2026-02-09-2300. This leads to some fun stuff like this:That's absolutely confusing and hard to work with.
The solution to this - not really mentioned in the docs (upgrade guide):
You should set your timezone either in
app.phporstatamic/system.php(display_timezone, which will fall back to your timezone set inapp.php). This will still convert everything to UTC in the background, but it will convert it back to what has been set in your config.For 99 % of sites, it's necessary to set a timezone and not leave it as UTC.
The solution I'd like to discuss/have
I think it's quite obvious that the current date behavior isn't really user-friendly and also quite a pain for developers, as we now explicitly have to check our timezone settings for the app. And while storing everything in UTC might be useful to some, it's rather cumbersome for the rest.
A probable and easy solution that could fit all use cases would be to give CP users a timezone preference. If not set, any date-input should be assumed to be the app timezone. Currently, it's always the users local timezone that is provided through the browser, which is the actual problem. This solution should make the statement of the docs completely true and the breaking change way less troublesome.
The questions I have are
What's the feedback from others that have upgraded to v6 and do have dates somewhere?
Beta Was this translation helpful? Give feedback.
All reactions