# Shadcn Relative Time

> Relative time popover with timezone details

- Type: example, free and open source (MIT)
- Component: [Popover](https://reui.io/components/popover.md)
- Page: https://reui.io/components/popover/c-popover-9
- Docs (Base UI): https://ui.shadcn.com/docs/components/base/popover.md
- Docs (Radix UI): https://ui.shadcn.com/docs/components/radix/popover.md
- MCP: `get_example("c-popover-9")`
- Registry item: https://reui.io/r/styles/base-nova/c-popover-9.json
- Uses: Badge, Popover

## Best for

A relative time inside a sentence, behind a dashed underline, that opens exact dates and clock times updating each second

## Agent notes

- `referenceTime` is always 2 hours before `now`, so pass your real deploy timestamp in its place
- The row badged UTC goes through date-fns `format`, which prints local time; convert it before showing it as UTC
- `now` reads the clock in `useState` during render, so a server rendered page hydrates with other seconds; set it after mount

## When not to use

- Exact deploy times revealed while the pointer rests on the label: use [Hover Card](https://reui.io/components/hover-card.md) (`get_component("hover-card")`)
- A field where the user picks an hour and minute rather than reads them: use [Time Picker](https://reui.io/components/time-picker.md) (`get_component("time-picker")`)

## Third-party libraries

- date-fns v4: [docs](https://date-fns.org/v4.1.0/docs/Getting-Started)

## Install

```bash
npx shadcn@latest add @reui/c-popover-9
```

## About Shadcn Popover

### When to use

- Quick edits and settings opened from a button, such as layer dimensions, switches or a volume slider
- Previews opened by a click, such as a person's bio card, a template image with actions or an AI feature pitch
- Inline details and short guides, such as exact times behind a relative date or a stepped feature tour

### When not to use

- A full account page that edits a person's name, avatar, email, team and billing: use the [Profile blocks](https://reui.io/blocks/application/profile.md)
- A full page of record fields, such as an invoice or a product, ending in a submit row: use the [Form blocks](https://reui.io/blocks/application/form.md)
- A task that must block the page and hold focus until the user answers: use [Dialog](https://reui.io/components/dialog.md) (`get_component("dialog")`)

### Agent notes

- Compose `PopoverTrigger` through `render` on the base twin and `asChild` on the radix twin, as every example does; the other twin's prop does not compose
- `PopoverContent` is w-72 in both twins whatever it holds; size it with a width class such as `w-auto` or `w-64`
- The base `PopoverTitle` names the popup for screen readers; the radix one is a plain div, so give radix `PopoverContent` an `aria-label`

Every ReUI item has a twin like this one; the index is https://reui.io/llms.txt. Agents with the ReUI MCP (https://reui.io/docs/mcp) get the same guidance from the getters named above.
