---
title: "Date Display"
description: "A date, a time, or a date range as text, in the order and words of the reader's language, in any time zone."
url: https://gelatinui.com/components/date-display
markdown_url: https://gelatinui.com/components/date-display.md
access: free
install: "npx shadcn@latest add @gelatin-ui/date-display"
registry_item: https://gelatinui.com/r/date-display.json
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Date Display

> A date, a time, or a date range as text, in the order and words of the reader's language, in any time zone.

Page: https://gelatinui.com/components/date-display

## When to use it

Best for: A date, a time, or a range as text that follows the locale, the zone, and the calendar.

- Use `dateStyle` and `timeStyle` for the common forms, or `format` for any other `Intl` options.
- Use `end` for a range. The shared parts show once.
- Use `relative` for today, yesterday, and tomorrow as words.
- Use `timeZone` to show the moment in another zone.

## When not to use it

- For the time since a moment, such as 5 min ago, use [Time Ago](https://gelatinui.com/components/time-ago.md).
- For the live time now, use a [Clock](https://gelatinui.com/components/clock.md).
- For a date that people pick, use a [Date Picker](https://gelatinui.com/components/date-picker.md).

## Notes for agents

- `date` takes an ISO string, a `Date`, epoch milliseconds, or an `@internationalized/date` value.
- An ISO date such as 2026-10-22 stays that day in every zone.
- It renders `<time dateTime>`. A range renders a span with one `<time>` per end.
- Set `tooltip={false}` in tables and long lists.
- An invalid date shows an em dash.

## Anatomy

```text
DateDisplay
└─ DateDisplayEmpty (0..n)
```

## API reference

### DateDisplay

| 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. |
| `dateStyle` | `"full" \| "long" \| "medium" \| "short"` |  | `full`, `long`, `medium` (the default when no style and no `format` is set), `short`. |
| `timeStyle` | `"full" \| "long" \| "medium" \| "short"` |  | `full`, `long`, `medium`, `short`. Alone: a time only. With `dateStyle`: the date and the time. |
| `format` | `Omit` |  | 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. |
| `timeZone` | `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. |

### DateDisplayEmpty

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `data-slot` | `string` |  | The `data-slot` of the root: the item's own slot (`"time-ago"`). Default `"empty-value"`. |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| DateDisplay | `date-display` |  |  |  |
| DateDisplayEmpty | `date-display-empty` |  |  |  |

## Usage

Pass the date and a style. Add `DateDisplayEmpty` for the text that shows when the date is missing.

```tsx title="order-dates.tsx"
import { DateDisplay, DateDisplayEmpty } from "@/components/ui/date-display";

type Order = { orderedAt: string; shippedAt: string | null };

export function OrderDates({ order }: { order: Order }) {
  return (
    <dl className="grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm">
      <dt className="text-muted-foreground">Ordered</dt>
      <dd>
        <DateDisplay date={order.orderedAt} dateStyle="medium" timeStyle="short" />
      </dd>
      <dt className="text-muted-foreground">Shipped</dt>
      <dd>
        <DateDisplay date={order.shippedAt} dateStyle="medium">
          <DateDisplayEmpty>Not shipped yet</DateDisplayEmpty>
        </DateDisplay>
      </dd>
    </dl>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/date-display
```

It adds 36 registry items: 33 files, 5552 lines, and the npm packages `@base-ui/react`, `@internationalized/date`, `@mantine/hooks`, `clsx`, `react-aria-components`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Full Value](https://gelatinui.com/components/full-value.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Time Ago](https://gelatinui.com/components/time-ago.md)
- [Local Time](https://gelatinui.com/components/local-time.md)
- [Date Picker](https://gelatinui.com/components/date-picker.md)
