Formatting Relative Time with JavaScript’s RelativeTimeFormat Constructor

John Au-Yeung
Level Up Coding
6 min readJan 6, 2020

--

Photo by Agê Barros on Unsplash

With the Intl.RelativeTimeFormat constructor, we can format relative time in a locale sensitive manner with ease. We can style in different ways and format it the manner we want. This lets us format relative time strings without the hassle that comes from manipulating strings. The constructor takes 2 arguments. The first argument is a locale string or an array of…

--

--