How to represent the number of days in natural language in JavaScript

1 · Amit Merchant · July 19, 2021, 3:21 p.m.
Extending the use of the Intl object from the previous article, today we’re going to talk about the Intl.RelativeTimeFormat object that has an important and relatively frequent usecase in modern web applications. Take the following for example. Let’s say, you’re developing a social media application and when the user of your application posts something, you might want to show the number of days passed since the day it has been posted intrinsically. For instance, if the user has posted a day ago,...