Skip to content
Design System
GitHub

A time of day, 24-hour with seconds ("14:02:31"), in a locale and an optional time zone: the one format every live component writes its last-update times in.

Install
npx shadcn add @syncrobotic/clock-time

Also installs: @syncrobotic/math

Overview

When to use

  • A last-update time beside live data: Stale since 14:02:31.
  • A log or an event's time of day.

Use something else

Usage rules

  • A time read during render differs between the server and the browser: read the clock with use-now and format what it returns.

API

What the file exports. The source is in the Source sheet above.

formatClockTime(date: Date, locale?: string, timeZone?: string)
A time of day, 24-hour with seconds ("14:02:31"), in a locale and an optional time zone: the one format every live component writes its last-update times in.

Changelog

  • 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
  • 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
  • 0.51.02026-11-27Stable: its API is a standard one the kit styles, unchanged for ten releases, with unit tests. It changes only in a major release from here. Comments trimmed to what they need to say; the code is unchanged.

How to upgrade