formatjs/formatjs-old

How to use Date with intl-relativeformat?

rightaway opened this issue · 1 comments

In 2.1.0 of intl-relativeformat I could do new IntlRelativeFormat('en').format(dateObject) and it would return the correct string based on the date, like 2 hours ago or in 3 years or in 5 minutes.

The package says it's deprecated now at https://www.npmjs.com/package/intl-relativeformat but the examples there don't say how you can use this new version with any Date object the same as the old version. https://github.com/tc39/proposal-intl-relative-time#take-number-instead-of-date-object-for-input says it's not possible.

What's the replacement for the previous functionality if I can't do this with Intl.RelativeTimeFormat? Is sticking with the old version of intl-relativeformat the only option?