Data
RelativeTime <pm-relative-time>
Relative time ("5 minutes ago", "in 2 days") that keeps itself up to date. Renders a <time> with the full date as a tooltip. format="datetime" shows an absolute, locale-formatted date instead.
Updated
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
datetime | string | — | ISO date/time. |
locale | string | — | BCP 47 locale for formatting (default: the page language). |
format | 'relative' | 'datetime' | relative | relative (default) or datetime. |
numeric | 'auto' | 'always' | auto | "auto" says "yesterday"; "always" says "1 day ago". |
date-styleprop: dateStyle | 'full' | 'long' | 'medium' | 'short' | — | How the date is written with format="datetime" (Intl dateStyle, default medium). |
time-styleprop: timeStyle | 'full' | 'long' | 'medium' | 'short' | — | How the time is written with format="datetime" (Intl timeStyle; no time when left off). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.