Skip to content

fix(db): set session timezone to UTC#59360

Open
susnux wants to merge 1 commit intomasterfrom
fix/sql-tz
Open

fix(db): set session timezone to UTC#59360
susnux wants to merge 1 commit intomasterfrom
fix/sql-tz

Conversation

@susnux
Copy link
Copy Markdown
Contributor

@susnux susnux commented Mar 31, 2026

Summary

Some (well all except sqlite) database platforms support timezone configuration. The problem is that we expect everything in UTC, but some servers might have set some different default (e.g. in database configuration or even just because of TZ environment variable).

This causes incorrect values when expecting NOW() to return the current time in UTC.

For PHP we already enforce UTC as timezone, this PR adds a middleware that enforces UTC also as the database connection / session timezone.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@susnux susnux added bug 3. to review Waiting for reviews feature: database Database related DB labels Mar 31, 2026
@susnux susnux added this to the Nextcloud 34 milestone Mar 31, 2026
@susnux susnux marked this pull request as ready for review March 31, 2026 21:35
@susnux susnux requested a review from a team as a code owner March 31, 2026 21:35
Some (well all except sqlite) database platforms support timezone
configuration. The problem is that we expect everything in UTC,
but some servers might have set some different default (e.g. in database
configuration or even just because of `TZ` environment variable).

This causes incorrect values when expecting `NOW()` to return the
current time in UTC.

For PHP we already enforce UTC as timezone, this PR adds a middleware
that enforces UTC also as the database connection / session timezone.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: database Database related DB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: (Files) Setting a reminder for a file ignores the timezone

2 participants