Reference

RelativeTime

A moment as 3 minutes ago, kept current, with the exact time on hover (<time>).

RelativeTime(_ when: Date or DateTime or String, datetime: String)

Since 6.2.0

Deployed

Created

Example

wf

Stack(gap: .xs) { Row(gap: .xs) { Text("Deployed") RelativeTime(@2026-11-01T09:30Z) } Row(gap: .xs) { Text("Created") RelativeTime(@2026-01-15) } }

From data, as an ISO string

wf

state comment = { author: "Ada", at: "2026-11-16T08:00:00Z" } Row(gap: .xs) { Text("{comment.author} replied") RelativeTime(comment.at) }

Props

Props of RelativeTime
PropTypeUnsetMeaning

when

Date or DateTime or String (positional)

—

The moment: a Date, a DateTime or an ISO string, shown as 3 minutes ago and kept current; the exact time is its title

datetime:

String

when, as text

The moment as a machine reads it, the <time>'s datetime attribute; written from when unless given

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

No flags of its own.

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Renders with the class wf-relative-time, stable across releases, so a stylesheet may target it.

These controls list the props' cases; the example below shows them written.