Intl.RelativeTimeFormat

MDN Link for Intl.RelativeTimeFormat

Browser Support

Available in Chrome from version 71
Available in Edge from version 79
Available in Firefox from version 65
Available in Opera from version 58
Available in Safari from version 14
Available in Chrome from version 71 Chrome
Available in Edge from version 79 Edge
Available in Firefox from version 65 Firefox
Available in Opera from version 58 Opera
Available in Safari from version 14 Safari
Available in Chrome Android from version 71 Chrome Android
Available in Firefox for Android from version 65 Firefox for Android
Available in Opera Android from version 50 Opera Android
Available in Safari on iOS from version 14 Safari on iOS
Available in Samsung Internet from version 10.0 Samsung Internet
Available in WebView Android from version 71 WebView Android
Available in Deno from version 1.8 Deno
Available in Node.js from version 12.0.0 Node.js
Specification

Input values

Style
Numeric

Output

unit

{ value: "year" , style: "long" , numeric: "auto" , }
// in 2 years
{ value: "years" , style: "long" , numeric: "auto" , }
// in 2 years
{ value: "quarter" , style: "long" , numeric: "auto" , }
// in 2 quarters
{ value: "quarters" , style: "long" , numeric: "auto" , }
// in 2 quarters
{ value: "month" , style: "long" , numeric: "auto" , }
// in 2 months
{ value: "months" , style: "long" , numeric: "auto" , }
// in 2 months
{ value: "week" , style: "long" , numeric: "auto" , }
// in 2 weeks
{ value: "weeks" , style: "long" , numeric: "auto" , }
// in 2 weeks
{ value: "day" , style: "long" , numeric: "auto" , }
// in 2 days
{ value: "days" , style: "long" , numeric: "auto" , }
// in 2 days
{ value: "hour" , style: "long" , numeric: "auto" , }
// in 2 hours
{ value: "hours" , style: "long" , numeric: "auto" , }
// in 2 hours
{ value: "minute" , style: "long" , numeric: "auto" , }
// in 2 minutes
{ value: "minutes" , style: "long" , numeric: "auto" , }
// in 2 minutes
{ value: "second" , style: "long" , numeric: "auto" , }
// in 2 seconds
{ value: "seconds" , style: "long" , numeric: "auto" , }
// in 2 seconds