# Relative Time Formats 1 - Custom formats

> RelativeTime with custom date and time format options.

A shadcn/ui block from the [@shadcnblocks](https://shadcnblocks.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/shadcnblocks/relative-time-relative-time-formats-1).

- Page, with a live preview: https://shadcn.exchange/r/shadcnblocks/relative-time-relative-time-formats-1
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/shadcnblocks/relative-time-relative-time-formats-1-light-617d9ad1080ec123.png
- Registry item: https://shadcnblocks.com/r/relative-time-relative-time-formats-1.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://shadcnblocks.com/r/relative-time-relative-time-formats-1.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `https://www.kibo-ui.com/r/relative-time.json`

## Files

### `example/relative-time/relative-time-formats-1.tsx`

```tsx
"use client";

import {
  RelativeTime,
  RelativeTimeZone,
  RelativeTimeZoneDate,
  RelativeTimeZoneDisplay,
  RelativeTimeZoneLabel,
} from "@/components/kibo-ui/relative-time";

export const title = "Custom formats";

const Example = () => (
  <RelativeTime
    className="w-full max-w-sm"
    dateFormatOptions={{
      weekday: "short",
      month: "short",
      day: "numeric",
    }}
    timeFormatOptions={{
      hour: "numeric",
      minute: "2-digit",
    }}
  >
    <RelativeTimeZone zone="UTC">
      <RelativeTimeZoneLabel>UTC</RelativeTimeZoneLabel>
      <div className="flex flex-col items-end gap-0.5">
        <RelativeTimeZoneDate />
        <RelativeTimeZoneDisplay />
      </div>
    </RelativeTimeZone>
  </RelativeTime>
);

export default Example;
```
