Repository navigation
feat: add a time zone selector to user preferences - #3449
karl-power merged 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 564bd5c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
E2E Test Results✅ All tests passed • 458 passed • 1 skipped • 1557s
Tests ran across 4 shards in parallel. |
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
9f562ff to
564bd5c
Compare
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
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 |
| }) | ||
| .formatToParts(date) | ||
| .find(part => part.type === 'timeZoneName')?.value; | ||
| return name ? gmtToUtc(name) : timeZone; |
There was a problem hiding this comment.
🔵 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
PR Review
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 lines2 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
[Medium impact] The PR appears safe to merge. SummaryReplaces the UTC switch with a searchable time zone selector.
No actionable issues were found. Reviews (1) · Last reviewed commit: "feat: add a time zone selector to user p..." · Reviewed by Greptile |
Deep ReviewReplaces the "Use UTC time" switch in User Preferences with a searchable ✅ No critical issues found. 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (6): correctness, kieran-typescript, testing, maintainability, julik-frontend-races, project-standards. 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 |
## 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
Summary
Replaces the "Use UTC time" switch in User Preferences with a time zone selector, so times can be shown in any zone.
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.timeZone.tsgainsgetSupportedTimeZones,getTimeZoneOffsetLabel,formatTimeZoneNameandgetLocalTimeZone; the time picker utils reusegetLocalTimeZone.UTC+09:00, and the sidebar badge and results table header showUTC+9instead of the browser'sGMT+9. Abbreviations likePDTare unchanged.Screenshots or video
How to test
Preview routes: /search
Steps:
References