Timeago
Relative or formatted timestamp. In isDuration mode it updates live via a setInterval. Accepts Date, ISO string, or numeric timestamp.
Preview
Preview
Usage
import { Timeago } from '@wire-ui/react'
// Live relative time ("5 minutes ago", "2 hours ago", "Just now")
<Timeago datetime={new Date()} isDuration />
// Formatted date ("Today, 09:00" / "15 Jun 2025, 09:00")
<Timeago datetime="2025-06-15T09:00:00" />
// Time only ("09:00")
<Timeago datetime={new Date()} timeOnly />Props
| Prop | Type | Default | Description |
|---|---|---|---|
datetime | Date | string | number | required | The timestamp to display |
isDuration | boolean | false | Show relative time (“5 minutes ago”); updates live |
timeOnly | boolean | false | Show only the time portion (“09:00”) |
className | string | — | Applied to the <time> element |
Live updates
In isDuration mode, the component sets a setInterval that recalculates the displayed string every minute. The datetime attribute on the <time> element always holds the original ISO timestamp for machine readability.
Last updated on