Skip to content

fix(insights): show previous-period tooltip dates#5

Open
lordspline wants to merge 1 commit into
masterfrom
capy/fix-insights-previous-period-tooltip-dates
Open

fix(insights): show previous-period tooltip dates#5
lordspline wants to merge 1 commit into
masterfrom
capy/fix-insights-previous-period-tooltip-dates

Conversation

@lordspline

@lordspline lordspline commented Jun 17, 2026

Copy link
Copy Markdown

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

  • Pass per-datum bucket dates through the shared Insight tooltip data path and format previous-period labels as compact labels such as Previous (5 Jun 2025).
  • Propagate resolved current and comparison date ranges, timezone, and week-start settings through legacy LineGraph and product analytics Trends chart wrappers that share the tooltip.
  • Keep aggregate/pie tooltips from inventing bucket dates when comparison rows are not time-series buckets.
  • Add parameterized date-boundary tests and Storybook cases for day, week, month, year-boundary, DST, and multi-breakdown comparison tooltips.

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 passed
  • pnpm --filter=@posthog/frontend format — completed with existing warnings and 0 errors
  • pnpm --filter=@posthog/frontend typescript:check — no errors reported by tsgo
  • Storybook screenshot capture via Playwright against Components/InsightTooltip previous-period day/week/month/year-boundary/DST/breakdown stories

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

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.

Open POST-031 POST-031


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@lordspline lordspline added the capy Generated by capy.ai label Jun 17, 2026 — with Capy AI
@capy-ai capy-ai Bot changed the title fix(insights): show previous-period bucket date in tooltips fix(insights): show previous-period tooltip dates Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dates for previous period in tooltip

1 participant