Skip to content

Relative Time ​

Dates

Loading...

Displays a localized time phrase relative to the current date and time. Uses the browser's Intl.RelativeTimeFormat API — no language packs needed.

  • Tag: <flint-relative-time>
  • Class: FlintRelativeTime

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintRelativeTime } from '@getufy/flint-ui';

Usage ​

html
<flint-relative-time></flint-relative-time>

Properties ​

PropertyAttributeTypeDefaultDescription
datedateDate | string | numbernew Date()The date to calculate time from. Accepts a Date, ISO string, or Unix ms timestamp. Defaults to the current date/time.
formatformat'long' | 'short' | 'narrow''long'The formatting style to use.
numericnumeric'always' | 'auto''auto'When auto, values such as "yesterday" and "tomorrow" will be shown when
syncsyncbooleanfalseKeep the displayed value up to date as time passes.
langlangstring''BCP 47 language tag for formatting (e.g. "en", "de", "ja"). Inherits from the document when unset.

CSS Parts ​

NameDescription
baseThe component's base wrapper element.

CSS Custom Properties ​

PropertyDefault
--flint-relative-time-color—
--flint-relative-time-font-size—
--flint-relative-time-cursortext
--flint-relative-time-font-weightinherit
--flint-relative-time-text-decorationnone
--flint-relative-time-white-spacenowrap