Skip to content
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

[5.x] Allow different timezone from app timezone for displaying date+time in CP and Antlers #10166

Open
wants to merge 5 commits into
base: 5.x
Choose a base branch
from

Conversation

florianbrinkmann
Copy link

Laravel encourages to not change the default UTC timezone in the config (https://laravel.com/docs/11.x/eloquent-mutators#date-casting-and-timezones), to prevent issues when comparing dates etc.

That said, I thought about how we could have both: the UTC timezone for all stored date/time values, but the values in the CP being displayed like in another timezone, for example Europe/Berlin, so if an editor in Germany tries to publish an entry immediately which has date+time enabled, it gets published right away and not when the UTC time is at the current point (so in one or two hours, depending on Daylight saving time)

I guess I did not find all places where that check and conversion should happen, so if you know of other places, please let me know :)

In general it should not change anything for existing and new installs, except the config value is set.

@robdekort
Copy link
Contributor

This could be great. I wonder if the client timezone should be a per site config option in sites.yaml so this could work for multisite as well.

@florianbrinkmann
Copy link
Author

I like the idea! Will check that out

@jacksleight
Copy link
Contributor

Also a user account timezone setting/override would be really useful, for when you have CP users in different timezones.

@jasonvarga
Copy link
Member

jasonvarga commented May 22, 2024

I think there should be an app config like you've done, and then a user preference that overrides it.

I wouldn't go as far as making different ones per-site.

@jasonvarga
Copy link
Member

This is a conflicting effort with #8636. We'll need to figure out the approach and consolidate them.

@robdekort
Copy link
Contributor

I wouldn't go as far as making different ones per-site.

Fair enough. We can probably already do that with a custom site attribute and some Antlers logic.

@florianbrinkmann
Copy link
Author

I think there should be an app config like you've done, and then a user preference that overrides it.

User preferences sounds good, but that preference would have to be limited to the CP part, so not in the src/Data/AbstractAugmented.php (not sure if that’s the best place), where it changes the values for displaying values of date fields in Antlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants