Skip to content

feat: add a time zone selector to user preferences - #3449

Merged
karl-power merged 1 commit into
claude/hdx-5741-timezone-preferencefrom
claude/hdx-5741-timezone-select
Oct 23, 2026
Merged

karl-power merged 1 commit into
claude/hdx-5741-timezone-preferencefrom
claude/hdx-5741-timezone-select

Conversation

@karl-power

Copy link
Copy Markdown
Contributor

Summary

Replaces the "Use UTC time" switch in User Preferences with a time zone selector, so times can be shown in any zone.

  • New TimeZoneSelect: a searchable dropdown with "Local (browser zone)" and "UTC" pinned at the top, followed by every zone the browser knows (Intl.supportedValuesOf('timeZone')). Each option shows its current offset, e.g. UTC-07:00; Local also shows its short name.
  • Zone names show underscores as spaces ("America/Los Angeles"), so typing "los angeles" finds them. The stored value stays the IANA name.
  • A stored zone the browser doesn't recognise shows as Local, matching how times fall back. A valid zone missing from the browser's list is added so it still displays.
  • The selector is a standalone component so the search page and dashboard time pickers can reuse it for their per-page override.
  • timeZone.ts gains getSupportedTimeZones, getTimeZoneOffsetLabel, formatTimeZoneName and getLocalTimeZone; the time picker utils reuse getLocalTimeZone.
  • Zones without a US abbreviation are labelled from UTC everywhere: the selector shows UTC+09:00, and the sidebar badge and results table header show UTC+9 instead of the browser's GMT+9. Abbreviations like PDT are unchanged.

Screenshots or video

Screenshot 2026-10-23 at 14 08 28 Screenshot 2026-10-23 at 14 08 44 Screenshot 2026-10-23 at 14 08 42

How to test

Preview routes: /search

Steps:

  1. Open the user menu at the bottom of the sidebar and click "User Preferences".
  2. Click the "Time zone" field and verify the first two options are "Local (…)" and "UTC".
  3. Type "tokyo" and click "Asia/Tokyo". Close the modal.
  4. Verify the sidebar shows a "UTC+9" badge next to the logo and the results table's timestamp column header ends with "(UTC+9)".
  5. Open "User Preferences" again, pick "UTC" in "Time zone", and close the modal.
  6. Verify the sidebar badge and the timestamp column header show "UTC".

References

  • Linear Issue: HDX-5741

@karl-power
karl-power added this pull request to stack #3448 October 23, 2026 12:10
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Oct 23, 2026 12:14pm UTC
hyperdx-storybook Ready Ready Preview Oct 23, 2026 12:14pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 564bd5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Minor
@hyperdx/api Minor
@hyperdx/otel-collector Minor

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

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 458 passed • 1 skipped • 1557s

Status Count
✅ Passed 458
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

Replace the "Use UTC time" switch with a searchable time zone selector.
Local and UTC are pinned above every zone the browser knows, and each
option shows its current offset.

- TimeZoneSelect is shared so the search and dashboard time pickers can
  reuse it
- Add timeZone helpers for the zone list, offset labels and display names
@karl-power
karl-power force-pushed the claude/hdx-5741-timezone-select branch from 9f562ff to 564bd5c Compare October 23, 2026 12:10
@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 4
  • Production lines changed: 207 (+ 132 in test files, excluded from tier calculation)
  • Branch: claude/hdx-5741-timezone-select
  • Author: karl-power

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 114 in total (1.41%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

})
.formatToParts(date)
.find(part => part.type === 'timeZoneName')?.value;
return name ? gmtToUtc(name) : timeZone;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 minor — Zones at a zero offset now show the same "UTC" badge as the UTC setting

gmtToUtc rewrites the bare "GMT" abbreviation as well as "GMT±N". So Europe/London, Europe/Dublin, Africa/Abidjan and Atlantic/Reykjavik now show "UTC" in the sidebar badge (components/AppNav/AppNav.tsx:281) and the timestamp header (components/DBRowTable.tsx:678). That looks exactly like picking UTC, and London's badge switches to "UTC+1" in summer, which hides the fact that it follows DST. The new test at __tests__/timeZone.test.ts:74 locks this in. Fix: only rewrite labels that carry an offset (/^GMT(?=[+-])/) so a real "GMT" abbreviation stays as it is.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    severity. Reply with one sentence; if it is critical, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

3 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 3 minor

1 posted as inline comment(s) on the changed lines. 2 listed below.

Findings outside the changed lines

2 minor
  • 🔵 packages/app/src/components/TimeZoneSelect.tsx:318 — Offset text uses the Mantine c="dimmed" colour instead of a semantic token → This breaks the "Semantic design tokens" convention. The same diff already uses c="var(--color-text-muted)" for the setting description in UserPreferencesModal.tsx:61; use that token here too.
  • 🔵 packages/app/src/components/__tests__/TimeZoneSelect.test.tsx:410 — No test covers keeping a valid zone the browser's list doesn't include → The [...supported, selected] branch at TimeZoneSelect.tsx:66 is a stated feature, but nothing exercises it. A regression that dropped it would show such a zone as an empty input and every test would still pass. Add a case with a valid alias the list doesn't include (e.g. 'US/Pacific') that checks the input shows US/Pacific and that the option appears under "All time zones".

Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Replaces the UTC switch with a searchable time zone selector.

  • People can pick any browser-known time zone in preferences.
  • Time labels use UTC offsets when no abbreviation exists.
  • Time picker utilities get the browser zone through a shared helper.

No actionable issues were found.

Reviews (1) · Last reviewed commit: "feat: add a time zone selector to user p..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

Replaces the "Use UTC time" switch in User Preferences with a searchable TimeZoneSelect, adds four helpers to timeZone.ts, and relabels non-abbreviated zones from GMT to UTC. The change is small, well-contained, and well-tested; downstream getTimeZoneShortName consumers (DBRowTable, AppNav) are display-only, so the GMT→UTC relabel carries no parsing risk.

✅ No critical issues found.

🟡 P2 — recommended

  • packages/app/src/components/TimeZoneSelect.tsx:66 — the branch that appends a valid IANA zone absent from getSupportedTimeZones() ([...supported, selected]) has no test; existing cases (local, UTC, invalid) all take the isPinned/isListed path and never exercise the append.
    • Fix: Add a test rendering a valid alias not in Intl.supportedValuesOf (e.g. US/Pacific) and assert it renders as a selectable option and round-trips through onChange.
    • testing, kieran-typescript, correctness
🔵 P3 nitpicks (2)
  • packages/app/src/components/TimeZoneSelect.tsx:90 — offsetLabels and zones both re-key off selected, so every selection change rebuilds a Map by constructing an Intl.DateTimeFormat per supported zone (several hundred) synchronously during render; search keystrokes are unaffected, so impact is bounded per-selection jank.
    • Fix: Compute the static full-list offset map once (stable dep or module scope) and merge only the dynamic Local/selected entries.
    • kieran-typescript, julik-frontend-races
  • packages/app/src/timeZone.ts:38 — Intl.supportedValuesOf('timeZone') is called with no feature guard, so a runtime lacking it (pre-2022 browsers, some embedded engines) throws and crashes the preferences modal render.
    • Fix: Guard with typeof Intl.supportedValuesOf === 'function' and fall back to an empty or minimal static list.

Reviewers (6): correctness, kieran-typescript, testing, maintainability, julik-frontend-races, project-standards.

Testing gaps:

  • No coverage of the valid-but-unlisted-zone append branch in TimeZoneSelect (primary P2 above).
  • Offset/short-name helpers lack assertions for half-hour/45-minute zones (e.g. Asia/Kathmandu) beyond the one Asia/Kolkata case; getLocalTimeZone has only indirect coverage.
  • TimeZoneSelect and UserPreferencesModal time-zone tests hard-depend on TZ=America/New_York and ICU abbreviations, so they are sensitive to runner locale/Node ICU version.

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

@pulpdrew pulpdrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@karl-power
karl-power merged commit 7eea0fd into main Oct 23, 2026
43 of 45 checks passed
kodiakhq Bot pushed a commit that referenced this pull request Nov 4, 2026
## Summary

Adds a time zone selector to the time picker on the search and dashboard pages. It overrides the User Preferences time zone for that page only and is kept in the `tz` URL param.

- `TimeZoneOverrideProvider` reads `tz`; `useDisplayTimeZone` prefers it over the user setting, so everything on the page switches together. Unknown values are ignored.
- The picker input shows the zone in use (e.g. `UTC-7`), highlighted when it isn't the browser's. The popover ends with the selector plus "Default", "UTC" and "Local" buttons; User Preferences gets "UTC" and "Local".
- Short zone labels are UTC offsets instead of abbreviations (`UTC-7`, not `PDT`). The selector shows the offset on each option and the selected value, and searches by it.
- Links from charts and tables to Search and other dashboards carry `tz`. External links don't.

The override isn't saved with saved searches or dashboards.

### Screenshots or video

<img width="529" height="243" alt="Screenshot 2026-10-30 at 10 39 50" src="https://github.com/user-attachments/assets/5cab281b-441d-48f0-9ae9-74d2c51abad7" />


<img width="664" height="319" alt="Screenshot 2026-10-30 at 10 40 02" src="https://github.com/user-attachments/assets/1822d592-ab3a-4597-b84f-78ba141d5349" />


### How to test on Vercel preview

**Preview routes:** /search, /dashboards

**Steps:**

1. On /search, click the time picker input (`data-testid="time-picker-input"`), click the "Time zone" field (`data-testid="time-picker-time-zone-select"`), type "tokyo" and click "Asia/Tokyo".
2. Verify the badge (`data-testid="time-picker-time-zone"`) shows "UTC+9" and the URL contains `tz=Asia%2FTokyo`.
3. Open the time picker, click "Default" (`data-testid="time-picker-time-zone-default"`), and verify `tz` is no longer in the URL.
4. On /dashboards, open any dashboard, repeat step 1, and verify the badge shows "UTC+9".

### References

- Linear Issue: Closes HDX-5741
- Related PRs: #3445, #3447, #3449

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 564bd5cd Deployed Oct 23, 2026 by vercel[bot]
Preview – hyperdx-storybook — 564bd5cd Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants