Repository navigation
refactor: store the time display setting as a time zone - #3447
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
E2E Test Results✅ All tests passed • 458 passed • 1 skipped • 1394s
Tests ran across 4 shards in parallel. |
🦋 Changeset detectedLatest commit: 80f234d 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 |
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (10 lines, under the 30-line bar for Tier 4) Review process: Full human review — logic, architecture, edge cases. Stats
|
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
[Medium impact] The PR appears safe to merge; no new blocking issues were found. SummaryReplaces
Reviews (2) · Last reviewed commit: "refactor: store the time display setting..." · Reviewed by Greptile |
Deep Review✅ No critical issues found. This is a contained, well-tested refactor: 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (7): correctness, testing, maintainability, project-standards, kieran-typescript, api-contract, adversarial. 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 |
Replace the isUTC user preference with timeZone: "local" or an IANA name. Stored settings convert once on load (true -> Etc/UTC, false -> local) and the old field is dropped. - useDisplayTimeZone reads timeZone; unrecognised zones fall back to local - useFormatTime, the results table, and the sidebar badge read the zone from it; the table header and badge show its short name - The "Use UTC time" switch writes timeZone until it becomes a time zone selector - Remove the isUTC option from formatDate
005c776 to
80f234d
Compare
## 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" preference with a
timeZonepreference, so a follow-up PR can turn the switch into a time zone selector. Nothing changes on screen.UserPreferences.isUTCbecomestimeZone:local(follows the browser) or an IANA name such asEtc/UTC. Stored settings convert once on load (true→Etc/UTC,false→local) andisUTCis dropped.useDisplayTimeZonereads the new preference. A zone the browser doesn't recognise falls back to local.useFormatTime, the results table and the sidebar UTC badge now read the zone fromuseDisplayTimeZoneinstead ofisUTC.UTC,PDT,GMT+9). For UTC this is the same text as before.timeZone.packages/app/src/timeZone.tsholds thelocalvalue, zone validation and the short name helper.formatDateloses itsisUTCoption. Its only other caller, the alert message template inpackages/api, passestimeZone: UTC_TIME_ZONE.How to test
Preview routes: /search
Steps:
References