Skip to content

Local Time

The time on the visitor's own clock, or in another place's time zone, following the clock.

$npx shadcn@latest add https://framebrick.co/r/local-time.json

From the Marai Neesu template, see it in context.

  • Your time
  • Dubai
  • Tokyo

Examples

With seconds

A 24-hour clock that ticks every second, in tabular figures.

Your time, to the second

<LocalTime seconds hour12={false} className="text-4xl font-semibold" />

Installation

$ npx shadcn@latest add https://framebrick.co/r/local-time.json

Usage

import { LocalTime } from "@/components/ui/local-time";

<LocalTime />
<LocalTime timeZone="Asia/Dubai" fallback="--:-- --" />
<LocalTime seconds hour12={false} />

Props

PropTypeDefaultDescription
timeZonestring—An IANA zone such as "Asia/Dubai"; the visitor's own zone when left out.
localestring"en-US"BCP 47 locale. "en-US" draws "7:41 PM".
secondsbooleanfalseShow seconds; the clock then ticks every second instead of every minute.
hour12boolean—Force a 12 or a 24 hour clock; the locale decides when left out.
optionsIntl.DateTimeFormatOptions—Any Intl.DateTimeFormat options, in place of the hour and minute ({ dateStyle: "medium" } draws a date).
fallbackReactNode—What the server draws, and the browser until it has the time. Nothing by default.
…propstime props—Passed to the <time> element (className, style, aria-*).
  • Three of our templates carry it as Framer's Time & Date code component: the Ciketo header (24-hour, over the date), the Lookis header and footer (the visitor's time) and the Marai Neesu footer (a place's time).
  • The server cannot know the visitor's moment, so it draws the fallback and the browser fills the time in right after hydration. React does not count that as a mismatch: the time is read through useSyncExternalStore with a server snapshot of null. Give fallback a placeholder the width of the time when the row must not move.
  • It ticks on the real boundary of the minute (the second with seconds), not on a timer that drifts, and draws again when the tab comes back to the front. Figures are tabular, so the text does not shift as the digits change.
  • It is a <time> element with a dateTime, not a live region: a clock that announced itself would speak every minute.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS component called LocalTime — a client component that renders a <time> element with the current time. No animation.
- Props: timeZone (IANA zone; the visitor's own when missing), locale (default "en-US"), seconds (boolean), hour12 (boolean), options (Intl.DateTimeFormatOptions, replacing the default hour numeric + minute 2-digit), fallback (ReactNode), className and the <time> attributes.
- Read the time with React.useSyncExternalStore: the snapshot is Intl.DateTimeFormat(locale, options).format(new Date()) as a string, the server snapshot is null, so the server draws the fallback and the browser fills the time in after hydration without a mismatch.
- subscribe: one setTimeout chain aligned to the real boundary (60 000 ms, or 1000 with seconds: delay = period - (Date.now() % period)), and refresh when the tab becomes visible (visibilitychange). Only a changed string re-renders.
- Tabular figures (tabular-nums). dateTime attribute = the ISO time once it is known. Not a live region.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy