fix(insights): show previous-period tooltip dates#5
Open
lordspline wants to merge 1 commit into
Open
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes PostHog#29757.
Trends tooltips with previous-period comparison showed the current and comparison values, but the comparison row only said “Previous”. That left the actual comparison bucket ambiguous for week/month buckets, year boundaries, DST transitions, partial ranges, and breakdown rows.
Changes
Previous (5 Jun 2025).Screenshot evidence was captured from Storybook for the main interval cases; examples included
Previous (5 Jun 2025),Previous (2-7 Jun 2025),Previous (May 2025), and breakdown rows with each series’ previous bucket date.How did you test this code?
As an agent, I ran:
hogli test frontend/src/scenes/insights/InsightTooltip/insightTooltipUtils.test.ts frontend/src/scenes/insights/views/LineGraph/LineGraph.test.tsx— 51 tests passedpnpm --filter=@posthog/frontend format— completed with existing warnings and 0 errorspnpm --filter=@posthog/frontend typescript:check— no errors reported by tsgoComponents/InsightTooltipprevious-period day/week/month/year-boundary/DST/breakdown storiesAutomatic notifications
Docs update
No docs update; this changes existing tooltip presentation copy only.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Captain Capy implemented this from the linked issue by first tracing the shared tooltip datum construction across legacy LineGraph and product analytics Trends charts, then applying the date label treatment in the shared Insight tooltip adapter/presentation layer instead of one chart. The chosen copy keeps the current bucket as the tooltip header and appends only the previous bucket date to comparison labels to avoid duplicate or ambiguous headings.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.