Pass the date and a style. Add DateDisplayEmpty for the text that shows when the date is missing.
order-dates.tsx
DateDisplay
<time>| Prop | Type | Default | Description |
|---|---|---|---|
| ref | Ref<HTMLElement> | — | The root element: a <time> for one date, a <span> for a range (each end is a <time> inside it), so the ref is an HTMLElement, not an HTMLTimeElement: read the ISO value from the dateTime of the <time> elements, not from the root of a range. |
| date | "full""long""medium""short" | — | full, long, medium (the default when no style and no format is set), short. |
| time | "full""long""medium""short" | — | full, long, medium, short. Alone: a time only. With dateStyle: the date and the time. |
| format | — | Own Intl.DateTimeFormat options (weekday, month, hour, hourCycle, …), which replace the two styles. The zone label goes here too: timeZoneName short ("EDT"), shortOffset ("GMT+9"), long. Intl does not take timeZoneName with dateStyle or timeStyle. | |
| date | DateLike | null | — | The date: a Date, an ISO string, epoch milliseconds, or a CalendarDate, CalendarDateTime, or ZonedDateTime. null, undefined, and a value that is not a date show the empty text. |
| end | DateLike | null | — | The end of a range. The text comes from formatRangeToParts: "Oct 3 – 9, 2026". The end prints in the zone of date, so give both ends the same kind of value (two days, or two instants). A range renders a <span> with one <time> around each end (see DateDisplay). |
| relative | boolean | false | Write the day as a word when it is yesterday, today, or tomorrow in the zone of the text: "Today", "Tomorrow, 9:30 AM", "Today, 2–4 PM" (a time range on one day; whole hours drop the ":00"), and "Mon – Wed, Nov 9 – 11" for days of the coming week. The words come from Intl.RelativeTimeFormat, and they show only after hydration (the server day is not the reader's day) or with now. Default false. |
| now | DateLike | — | A fixed now for relative (tests, stories): with it, no clock runs. |
| time | string | — | The IANA zone of the text ("America/New_York"). Default: the zone of a ZonedDateTime, else the runtime zone. Pass it in a server-rendered app: the server zone and the reader's zone can print two different days. |
| locale | string | — | The BCP 47 language tag ("en-GB", "ja-JP-u-ca-japanese"). Default: the DisplayLocaleProvider locale, else "en-US". It sets the words, the order, the digits, the calendar system, and dir. |
| tooltip | boolean | true | Show the ISO value with its offset in a Tooltip on hover. Default true. |
| children | ReactNode | — | A DateDisplayEmpty part: the words of no value. With a value, they are not drawn. |
| ...props | <time> attributes | — | Every other attribute goes to the <time>. |
DateDisplayEmpty
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| data-slot | string | — | The data-slot of the root: the item's own slot ("time-ago"). Default "empty-value". |
From Base UIUseRenderBase UI docs | |||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
Built with
Installs with Date Display
- Components
- Full Value





