Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,26 @@ Built on **Temporal** for precise date math and **Intl.RelativeTimeFormat** for

```bash
npm install relative-time
# If your environment doesn't yet support Temporal:
```

### Temporal polyfill

This library expects **Temporal**. Use it where Temporal is available, or load the official polyfill:

```bash
npm install @js-temporal/polyfill
```

> This library expects **Temporal**. Use it where Temporal is available (or load the official polyfill).
When using `@js-temporal/polyfill`, **inject** `Temporal` when constructing `RelativeTime`/`RelativeTimeResolver`:

```js
import RelativeTime, { RelativeTimeResolver } from "relative-time";
import { Temporal } from "@js-temporal/polyfill";

const rt = new RelativeTime({ Temporal });
// or:
const resolver = new RelativeTimeResolver({ Temporal });
```

## Quick start

Expand Down