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

getting default timezone for local time #49087

Merged

Conversation

AIlkiv
Copy link
Contributor

@AIlkiv AIlkiv commented Nov 5, 2024

Summary

In the server/lib/base.php file of the Nextcloud server, UTC is always set as the default timezone:

if (!date_default_timezone_set('UTC')) {

The main argument for this choice seems to be to simplify log reading, as discussed in this issue: #3553.

However, this hardcoding of UTC affects all instances where date_default_timezone_get is used, resulting in UTC even when it would be more intuitive to use the server's timezone or the one set in config.php under default_timezone.

This pull request resolves an issue in the contact menu where the timezone was unexpectedly set to UTC. The fix aligns with other parts of the system that correctly retrieve the default timezone by leveraging similar logic:

https://github.com/search?q=org%3Anextcloud+%22%3EgetDefaultTimeZone%28%22&type=code

image

TODO

  • ...

Checklist

@AIlkiv AIlkiv force-pushed the getting-default-timezone-for-local-time branch from a333f15 to 3d2f2e4 Compare November 5, 2024 09:38
@AIlkiv AIlkiv force-pushed the getting-default-timezone-for-local-time branch from 3d2f2e4 to 1ab1bbd Compare November 5, 2024 17:58
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to use default_timezone here 👍

Thank you very much

@nickvergessen
Copy link
Member

This pull request resolves an issue in the contact menu where the timezone was unexpectedly set to UTC. The fix aligns with other parts of the system that correctly retrieve the default timezone by leveraging similar logic:

A login of that user should fix the problem

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Nov 9, 2024
@skjnldsv skjnldsv merged commit 8ff3f21 into nextcloud:master Nov 9, 2024
164 of 167 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants