Skip to content
Kimenpre-v1documentation home
Color scheme

ki-relative-time

Pass an ISO timestamp. numeric="auto" can display words like “yesterday”. Set numeric="always" to use numeric wording. Add sync to refresh the text as time passes, and set threshold in seconds to switch to an absolute timestamp when the distance reaches the cutoff.

Theme for this example
Color scheme for this example
<ki-relative-time date="2026-11-19T08:41:00Z" sync threshold="86400"></ki-relative-time>

The result uses native time semantics. Its absolute timestamp is available to assistive technology and in the tooltip. The visible wording changes without a live announcement.

API reference

When to use: For timestamps whose distance from the present matters, such as timeline entries or recent changes.

When not to use: For an interactive countdown or a date that should always show an absolute value.

Properties & attributes

AttributePropertyTypeDefaultDescription
datedatestring | undefined–ISO calendar date or date-time. A timestamp without an offset uses local time.
numericnumeric"always" | "auto"'auto'Auto can show words such as yesterday. Always uses a number.
syncsyncbooleanfalseRefresh the visible wording as the clock crosses a formatting boundary.
thresholdthresholdnumber | undefined–Display an absolute timestamp when the distance reaches this many seconds. Omit to keep relative wording at any distance.

CSS custom properties

The public styling contract of ki-relative-time: reassign these tokens at :root or on a subtree — never override internals.

TokenDescription
--ki-relative-time-font-familyDefault body font family for ki-relative-time on a bare page.

Workshop

Open ki-relative-time in Storybook