Skip to content

[ENHANCEMENT] Display GMT offset next to time range selector#106

Open
DeeBi9 wants to merge 5 commits into
perses:mainfrom
DeeBi9:timzone3941
Open

[ENHANCEMENT] Display GMT offset next to time range selector#106
DeeBi9 wants to merge 5 commits into
perses:mainfrom
DeeBi9:timzone3941

Conversation

@DeeBi9
Copy link
Copy Markdown

@DeeBi9 DeeBi9 commented Apr 18, 2026

Description

Display the active timezone as a GMT offset alongside the time range selector.
This PR only introduces a visual indicator and does not modify timezone persistence behavior.

Closes perses/perses#3941

Screenshots

image

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.
  • E2E tests are stable and unlikely to be flaky.
    See e2e docs for more details. Common issues include:
    • Is the data inconsistent? You need to mock API requests.
    • Does the time change? You need to use consistent time values or mock time utilities.
    • Does it have loading states? You need to wait for loading to complete.

DeeBi9 added 2 commits April 18, 2026 15:07
Signed-off-by: Deepanshu Bisht <deepanshudb1@gmail.com>
Signed-off-by: Deepanshu Bisht <deepanshudb1@gmail.com>
@DeeBi9 DeeBi9 requested a review from a team as a code owner April 18, 2026 09:54
onClick={() => setOpen(!open)}
IconComponent={Calendar}
renderValue={() => (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
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.

We can use a Stack instead

Comment thread components/src/utils/format.test.ts Outdated
const browserOffset = getGMTOffset('browser');

expect(localOffset).toContain('GMT');
expect(browserOffset).toContain('GMT');
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.

it seems that we are not asserting correctly what the offset should be

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

YEs, I will update this too shortly

Comment thread components/src/utils/format.ts Outdated
@Gladorme
Copy link
Copy Markdown
Member

Gladorme commented Apr 20, 2026

Thanks for the PR 😄 I think this feature may need some reflections:

  • I understand it can be helpful to see the GMT, but I think not everyone prefer GMT depending of the region (UTC, EST, ...)?
  • It using some space at variable level and we should use allocate the maximum space to them.
  • I think some people don't care about it as they will always use the local time

[value, timeZone]
);

const selectedDisplay = useMemo(() => {
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.

we probably don't need this as the value is passed to the renderValue function and we can use formatTimeRange(value, timeZone) directly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

should we preserve descriptive labels like "Last x minutes/hours", or is the formatted value sufficient?

@jgbernalp
Copy link
Copy Markdown
Contributor

jgbernalp commented Apr 20, 2026

@DeeBi9 thnx for your contribution, apart from other comments there seem to be lint and formatting issues, mind checking?

@DeeBi9
Copy link
Copy Markdown
Author

DeeBi9 commented Apr 20, 2026

Thanks for the PR 😄 I think this feature may need some reflections:

  • I understand it can be helpful to see the GMT, but I think not everyone prefer GMT depending of the region (UTC, EST, ...)?

  • It using some space at variable level and we should use allocate the maximum space to them.

  • I think some people don't care about it as they will always use the local time

To address space , we could use one approach that to only display the timezone indicator when it differs from local. That way it avoids adding noise for users who always use local time.

I used GMT offset because it was suggested in the issue, but we could also consider 'region-based' representation.

Whatever best aligns with UI.

@DeeBi9
Copy link
Copy Markdown
Author

DeeBi9 commented Apr 20, 2026

@DeeBi9 thnx for your contribution, apart from other comments there seem to be lint and formatting issues, mind checking?

Sure I will check and fix that.
Thanks!

Signed-off-by: Deepanshu Bisht <deepanshudb1@gmail.com>
Comment thread components/src/TimeRangeSelector/TimeRangeSelector.tsx Outdated
DeeBi9 added 2 commits April 24, 2026 16:26
Signed-off-by: Deepanshu Bisht <deepanshudb1@gmail.com>
Signed-off-by: Deepanshu Bisht <deepanshudb1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display time zone indicator within or next to the time range control

3 participants