themojilla / rago

A utility helper to calculate "time ago" or "from now " in a readable format using Intl API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rago

A utility helper to calculate "time ago" or "from now " in a readable format using Intl API. npm version

Warning: the rago tend to use Intl API internally. It is made for modern browsers, but if you want to keep things also working for older ones, make sure to polyfill the Intl API

Installation

yarn add rago

Usage

import { fromNow } from 'rago';

fromNow('2019-04-21T11:34:41.773Z'); // 2 years ago
fromNow('2020-04-21T12:24:01Z', 'fa'); // سال گذشته

About

A utility helper to calculate "time ago" or "from now " in a readable format using Intl API


Languages

Language:TypeScript 77.5%Language:HTML 15.4%Language:Shell 3.8%Language:JavaScript 3.3%