Skip to content

Time Ago Card

The TimeAgoCard component displays a timestamp in a human-readable format, such as “5 min. ago”. Hovering (or focusing) the value reveals a tooltip with the full date and time in both UTC and the local timezone.

Variations

Timestamp variants

The timestamp prop accepts an ISO 8601 string, a Unix timestamp number, or null. When omitted, nothing is rendered.

Time difference examples

The component displays relative time in a narrow format for all time ranges:

Future timestamps

The component also handles future timestamps:

With prefix

Live updating

Set live to have the relative time re-render every second so it stays current without a page refresh.

Installation

import { TimeAgoCard } from "@harnessio/ui/components";
<TimeAgoCard timestamp={new Date().toISOString()} />;