nta

2.0.2 • Public • Published

What is this ?

This is a simple lightweight JS Time Ago module, that supports different languges and you can contribute to add yours.

please checkout the change log if you want to know whats changed.

works on the browser and server

if you want to use it on the browser, you must include the nta.min.js file into you html file
else if you are using server side rendering or any js framework, just npm install it and import it as you import any other package

Languages available for now are:

ar: arabic, en: english, de: german, vn: vietnamese

Display formats

// ago format, this is the default format
timeAgo('2020-01-16 19:48:45', 'en'); // will return: 3mo ago
 
// full format
timeAgo('2020-01-01 19:48:45', 'en', 'full'); // will return: 1 January
 

Usage

after installing nta

const timeAgo = require('nta');
 
timeAgo(new Date, 'en')

params
timeAgo function accepts 3 parameter wich are the date, language, format.
the language is not required, arabic is set by default
the format is not required too, "ago" is set by default

Accessible to your views ?

app.locals.timeAgo = timeAgo

Thats is it, nta is now accessible to all of your views you can use it as specified above.

Dont Forget to contribute by adding your language or any other feature you like

/nta/

    Package Sidebar

    Install

    npm i nta

    Weekly Downloads

    3

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    8.16 kB

    Total Files

    4

    Last publish

    Collaborators

    • wassim_bj