improvement(settings): right-align timezone picker, order by popularity, drop tooltip by waleedlatif1 · Pull Request #5043 · simstudioai/sim · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions apps/sim/lib/core/utils/timezone.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest'
import {
getSupportedTimezones,
getTimezoneOptions,
wallClockNow,
zonedClockDate,
zonedWallClockToUtc,
Expand Down Expand Up @@ -68,6 +69,37 @@ describe('getSupportedTimezones', () => {
})
})

describe('getTimezoneOptions', () => {
it('renders every zone as "City (GMT±HH:MM)"', () => {
const options = getTimezoneOptions()
expect(options.length).toBeGreaterThan(0)
for (const option of options) {
expect(option.label).toMatch(/^.+ \(GMT[+-]\d{2}:\d{2}\)$/)
}
})

it('orders zones alphabetically by city', () => {
const cities = getTimezoneOptions().map((option) =>
option.label.replace(/ \(GMT[+-]\d{2}:\d{2}\)$/, '')
)
expect(cities).toEqual([...cities].sort((a, b) => a.localeCompare(b)))
})

it('uses a live DST-aware offset and a friendly city', () => {
const options = getTimezoneOptions()
expect(options.find((o) => o.value === 'UTC')?.label).toBe('UTC (GMT+00:00)')
// India has no DST, so this offset is stable regardless of when the test runs.
expect(
options.find((o) => o.value === 'Asia/Kolkata' || o.value === 'Asia/Calcutta')?.label
).toMatch(/^(Kolkata|Calcutta) \(GMT\+05:30\)$/)
})

it('has no duplicate values', () => {
const values = getTimezoneOptions().map((o) => o.value)
expect(new Set(values).size).toBe(values.length)
})
})

describe('zonedClockDate', () => {
const instant = new Date('2026-06-15T13:00:00.000Z')

Expand Down
44 changes: 44 additions & 0 deletions apps/sim/lib/core/utils/timezone.ts
Loading