Skip to content

Pass segment timestamps in site timezone#6286

Merged
apata merged 5 commits intomasterfrom
segments-timestamps-to-site-tz
May 4, 2026
Merged

Pass segment timestamps in site timezone#6286
apata merged 5 commits intomasterfrom
segments-timestamps-to-site-tz

Conversation

@apata
Copy link
Copy Markdown
Contributor

@apata apata commented Apr 28, 2026

Changes

The frontend doesn't have enough information to render the UTC timestamps sent to it correctly.

Site timezone offset isn't enough, because the offset is dynamic. It depends on the time.

For example, for a site with the timezone Tallinn/Estonia, the UTC datetime 2026-01-01T00:00:00 must be rendered as 2026-01-01 02:00:00 whereas 2026-04-01T00:00:00 must be rendered as 2026-04-01 03:00:00.

This problem manifests with segment related timestamps: if the user on the Tallinn/Estonia site creates a segment in January and looks at it in April, the shown timestamp will be off by one hour, because we use the offset right now.

This PR fixes it by converting the dates on the backend.
The alternative would be to provide the timezone locale to the FE and use that. The issue with that is the tz database falling out of sync between the BE and the FE. Also, we already convert some dates on the backend (in queries with the time dimension).

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@apata apata force-pushed the segments-timestamps-to-site-tz branch from 2e49f68 to 2214990 Compare April 28, 2026 16:08
@apata apata changed the title Pass segments timestamps in site TZ Pass segment timestamps in site timezone Apr 28, 2026
@apata apata force-pushed the segments-timestamps-to-site-tz branch from 6630b37 to 8188f02 Compare April 28, 2026 16:35
@apata apata added the preview label Apr 28, 2026
@github-actions
Copy link
Copy Markdown

Preview environment👷🏼‍♀️🏗️
PR-6286

@apata apata requested a review from a team April 28, 2026 16:51
@apata apata removed the preview label Apr 28, 2026
Copy link
Copy Markdown
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

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

Looks good to me! But could we also add a test to actually assert on the timestamps being shifted into site timezone when passed to the frontend?

@apata apata added this pull request to the merge queue May 4, 2026
Merged via the queue into master with commit 2cc209c May 4, 2026
21 checks passed
@apata apata deleted the segments-timestamps-to-site-tz branch May 4, 2026 09:22
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.

3 participants