Repository navigation
fix(app): show dates on x-axis ticks at daily granularity - #3779
Conversation
Time charts formatted the first x-axis tick as date and time and every
other tick as time only, whatever the granularity. At 1 day granularity
every tick after the first read 00:00:00, so daily charts looked hourly.
At daily granularity or coarser, ticks now show the date ("Oct 27"). Day
buckets are UTC-aligned, so when a bucket does not start at midnight in
the display time zone the tick shows the date and time ("Oct 26 7:00PM").
Sub-day granularity is unchanged.
Refs HDX-6176
🦋 Changeset detectedLatest commit: eba74fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: spans packages but only 67 prod lines — under the 100-line cross-layer bar Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. The change is well-scoped and correct. Reviewers confirmed the two paths stay consistent: 🔵 P3 nitpicks (3)
Reviewers (6): correctness, testing, maintainability, project-standards, kieran-typescript, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 475 passed • 1 skipped • 1103s
Tests ran across 4 shards in parallel. |
Summary
Time charts formatted the first x-axis tick as date and time and every other tick as time only, whatever the granularity. At 1 day granularity every tick after the first read
12:00:00 AM(or00:00:00on a 24h clock), so a daily chart looked like it was broken down by hour. The data and the hover tooltip were correct; only the axis labels were wrong.At daily granularity or coarser, ticks now show the date (
Oct 27). Day buckets are UTC-aligned, so outside UTC they don't start at local midnight. In that case the tick shows the date and time (Oct 26 7:00PM), so the label stays accurate about where the bucket starts. Sub-day granularity is unchanged.packages/common-utils: newdateformat (MMM d) forformatDate.packages/app:getXAxisTickDateFormatpicks the tick format from the granularity, tick time and display time zone;xTickFormatterinMemoChartuses it. This covers every time chart (chart explorer, dashboard tiles, compact tiles).chart-explorer.spec.tswith the browser time zone pinned: UTC at 1 day (every tick is a date), UTC at 1 hour (unchanged behavior), and America/New_York at 1 day (date and time). With the fix reverted, both daily tests fail with the original labels; the 1 hour test passes on both.Out of scope: sub-day granularity over a multi-day range (e.g. 7 days at 12 hours) also shows time-only ticks without dates. Changing that affects most multi-day charts, so it should be a separate change.
Screenshots or video
Chart explorer, E2E Logs, count of events, last 30 days, 1 Day Granularity, 12h clock. I couldn't upload images from the CLI; I'll add the screenshots below. Tick labels as rendered:
Oct 25 12:00:00 AM,12:00:00 AM,12:00:00 AM, …Oct 25,Oct 29,Nov 2, …Nov 24Oct 24 8:00:00 PM,8:00:00 PM,7:00:00 PM, …Oct 24 8:00PM,Oct 29 8:00PM,Nov 3 7:00PM, …How to reproduce
Starting point: play.hyperdx.io/chart, or
yarn app:dev:local→ onboarding → "Connect to Demo Server". Set your display time zone to UTC (time picker → time zone) to match the first row above.On
main:12:00:00 AM.On this branch:
Oct 25,Oct 29, …).Oct 24 8:00PM, …).main(date on the first tick, time only on the rest).How to test on Vercel preview
Preview routes: /chart
Steps:
References