a lite npm package to generate time ago string from date
npm install time-ago-lite_A liteweight library to generate time ago string from a date_
$ yarn add time-ago-lite
or
$ npm add time-ago-lite
import { relativeTimeEn } from 'time-ago-lite';
const yourRelativeTimeString = relativeTimeEn(yourDate);
import { relativeTime, wordsFn } from 'time-ago-lite';
/**
* Words function based on your language rules
* It needs to conform to the wordsFn interface
*/
const yourLangWords: wordsFn = (number = 1, unitKey = 'now', isInPast = true) => {
// Your implementation here, see the enWords in the index.ts
// or srWords in the index.spec.ts
};
const relativeTimeYourLang = relativeTime(yourLangWords);
const yourRelativeTimeStringInYourLang = relativeTimeYourLang(yourDate)