---
title: Relative date
description: A component to convert datetimes to relative dates strings, such as "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc. using JavaScript's Intl.RelativeTimeFormat API.
---
A component to convert datetimes to relative dates strings,
such as "a minute ago", "in 2 hours", "yesterday", "3 months ago",
etc. using JavaScript's Intl.RelativeTimeFormat API.
*Some examples (as if the datetime was `June 20th, 2024 6:30pm`)*:
| Source | Relative date
| -----------------------------------------| --------------
| `` | 6 months ago
| `` | yesterday
| `` | 5 hours ago
| `` | in 19 hours
| `` | next week
| `` | 32 years ago
## How it works
The `RelDate` component is rendered as an empty `