DEVELOPMENT PREVIEWIn development

timestamp API

data/timestamp.tsx

TimestampProvider

Props

PropTypeDefaultDescription
children*
React.ReactNode—The subtree whose timestamps use these defaults.
hour12
boolean | undefinedthe locale's conventionForce a 12-hour (true) or 24-hour (false) clock.
locale
string | undefinedthe browser localeValidated once; an invalid tag falls back to the browser locale and is reported.
messages
anythe English messagesPartial overrides of the English defaults.
timeZone
string | undefinedthe viewer's zoneValidated once with isSupportedTimeZone; an invalid zone falls back to the viewer's zone and is reported.
Show native HTML props

Native HTML Props

PropTypeDefaultDescription
onError
((issue: TimestampIssue) => void) | undefined—Receives invalid values, invalid configuration and copy failures; wire it to the app's structured logger. A function, so wrap the provider in your own `"use client"` component to pass it.

useTimestamp

Timestamp

Props

PropTypeDefaultDescription
copyable
boolean | undefinedtrueWhether clicking copies. Set false inside an `<a>` or a stretched-link card: renders a non-focusable span with a hover tooltip and no copy. In a row with its own onClick or onKeyDown, keep the default; the click, Enter and Space stop at the timestamp.
direction
TooltipDirection | Side | undefinedTooltipDirection.TopSide the tooltip prefers.
format
TimestampFormat | "COMPACT" | "RELATIVE" | "CONTEXTUAL" | "TIME" | "ABSOLUTE" | "DATE" | undefinedTimestampFormat.RelativeHow the visible label reads.
hour12
boolean | undefinedthe nearest TimestampProvider, else the locale's conventionForce a 12-hour (true) or 24-hour (false) clock.
locale
string | undefinedthe nearest TimestampProvider, else the browser localeBCP 47 locale. Invalid values fall back and are reported.
ref
any—Ref to the root span, which exists in every state.
timeZone
string | undefinedthe nearest TimestampProvider, else the viewer's zoneIANA time zone. Invalid values fall back and are reported.
Show native HTML props

Native HTML Props

PropTypeDefaultDescription
className
string | undefined—Extra classes on the root span.
id
string | undefined—Id on the root span.
onCopied
((text: string) => void) | undefined—Called with the copied text after a successful copy. A function, so it cannot be passed from a Server Component.
value*
any—The moment or calendar date to show. See TimestampValue.