Timezone Mismatch

When the device's time zone differs from the account's, shows both clocks and asks once which to use, so times aren't misread while travelling.

StopsMisread every time by hours while travelling

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/timezone-mismatch.json

The files land in your project. They're yours to edit.

Usage

timezone-mismatch-usage.tsx
import { TimezoneMismatch, zoneCity } from "@/components/ui/timezone-mismatch"

<TimezoneMismatch
  key={run}
  accountTimeZone={zone}
  deviceTimeZone="Europe/London"
  storageKey={storageKey}
  onUseDeviceZone={setZone}
/>

What it catches

  • Device and account zones that differ now or at any clock change in the coming year
  • Zones that drift apart only for a few days (e.g. Jerusalem and Athens)
  • Unknown zones the runtime can't resolve
  • The user's choice, remembered per pair of zones

Props

TimezoneMismatch props
PropTypeDefault
accountTimeZone* (required)

The time zone saved on the account; times are shown in it today.

string—
deviceTimeZone

Override the detected device zone (tests, demos, or a zone from your own location service).

string—
onUseDeviceZone* (required)

Switch the account (or this session) to the device zone.

(timeZone: string) => void—
onKeepAccountZone

Called when the user keeps the account zone.

() => void—
storageKey

localStorage key that remembers the answer per account → device zone pair. `null` disables it.

string | null"bollard-ui:timezone-choice"
message

Templates: `{device}`, `{account}` (city names) and `{gap}` ("5 h 30 min ahead") are filled in.

string"You're in {device} time, {gap} of your account's {accoun…
deviceLabel

Label of the device clock.

string"Device"
accountLabel

Label of the account clock.

string"Account"
useDeviceLabel

Label of the use-device-zone button.

string"Use device zone"
keepAccountLabel

Label of the keep-account-zone button.

string"Keep account zone"
doneText

Shown for a moment after the answer. `{zone}` is the city now used.

string"Times now show in {zone} time."
regionLabel

Accessible name of the banner.

string"Time zone mismatch"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Banner is a region with an aria-label; result is role=status and receives focus
  • Message in a polite live region
  • Animations respect reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Choice is stored in localStorage on this device
  • Device zone comes from the browser and can be wrong behind some VPNs or settings

What it stops

Misread every time by hours while travelling

Also known as

time zone · timezone · device time · account time zone · travel · ist · tz database · clock

Field type

Dependencies

Pairs well with