8000 fix(trends): redo dst fix with `toDate` by thmsobrmlr · Pull Request #32111 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(trends): redo dst fix with toDate #32111

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

thmsobrmlr
Copy link
Contributor
@thmsobrmlr thmsobrmlr commented May 9, 2025

Reverts the revert #32075 of #31984

Now uses toDate to convert timestamps for daily intervals in a DST-compatible manner.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr force-pushed the revert-32075-revert-31984-fix-trends-dst-dates-2 branch from 34438c5 to 1d60f05 Compare May 11, 2025 14:17
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 5)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr changed the title fix(trends): revert fix dates after dst transition fix(trends): redo dst fix with toDate May 11, 2025
@thmsobrmlr thmsobrmlr marked this pull request as ready for review May 11, 2025 19:13
Copy link
Contributor
@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR fixes DST (Daylight Saving Time) transition issues in trends queries by using toDate for timestamp conversions instead of toStartOfDay, particularly affecting daily intervals.

  • Modified trends_query_builder.py to use toDate for daily intervals and adjusted date_from_start_of_interval_for_addition handling in date subqueries
  • Added comprehensive DST transition tests covering Egypt's UTC+02 to UTC+03 shift and US Pacific timezone changes
  • Removed redundant parentheses around ast.Constant arguments in query_date_range.py date conversion methods
  • Fixed issue where queries with day windows crossing DST boundaries were incorrectly returning 0 after the transition

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 9393 to +9396
response[0]["data"],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
)

Copy link
Contributor

Choose a reason for hiding this comment

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

style: The test data setup creates events with increasing counts per hour (0 to 23 events), but the assertion only checks for the raw hour numbers. Consider asserting the actual event counts to verify the aggregation logic.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 5)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@PostHog PostHog deleted a comment from posthog-bot May 19, 2025
@thmsobrmlr thmsobrmlr removed the stale label May 19, 2025
@thmsobrmlr thmsobrmlr force-pushed the revert-32075-revert-31984-fix-trends-dst-dates-2 branch from ab25a83 to 1d60f05 Compare May 19, 2025 12:28
@thmsobrmlr thmsobrmlr force-pushed the revert-32075-revert-31984-fix-trends-dst-dates-2 branch from 06851eb to 461a9e7 Compare May 19, 2025 12:53
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

< 8000 input type="hidden" name="badge_size" value="small" autocomplete="off" data-targets="batch-deferred-content.inputs" />
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor
github-actions bot commented May 19, 2025

Size Change: 0 B

Total Size: 3.65 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 3.65 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

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

Successfully merging this pull request may close these issues.

2 participants
0