Skip to content

Conversation

@nmn
Copy link
Owner

@nmn nmn commented Apr 13, 2025

New universal formatter based on browser's built-in Intl package.

Introducing a new API to create a better formatter using the Intl module built into Javascript.

You can use it something like this:

import {makeIntlFormatter} from 'react-timeago/defaultFormatter';

const intlFormatter = makeIntlFormatter();

<TimeAgo formatter={intlFormatter} date={new Date()} />

makeIntlFormatter takes an options object where you can configure locale and some other options which are then passed into Intl.RelativeTimeFormat.

@nmn nmn force-pushed the feat/intl-formatter branch from 5cc4db4 to 92d661f Compare April 14, 2025 00:21
@nmn nmn requested a review from Copilot April 14, 2025 00:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • package.json: Language not supported

@nmn nmn merged commit 5e8bc5c into master Apr 14, 2025
3 checks passed
@nmn nmn deleted the feat/intl-formatter branch April 14, 2025 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants