Skip to main content

Time

Time renders a date or time value in a semantic <time> element with a formatted label and a machine-readable dateTime attribute.

Example

<Time
  dateTime="2026-10-01T08:00:00"
  format="YYYY-MM-DD HH:mm"
/>

Usage

<Time dateTime={article.publishedAt} format="YYYY-MM-DD" />

dateTime accepts a Date, timestamp, or date string; format follows the web-utility formatDate tokens such as YYYY, MM, DD, HH, and mm. The text re-renders whenever either prop changes.

For relative output such as "3 day(s) before", use Time distance.