2.0.2 • Published 4 years ago

nta v2.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

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

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

1.0.0

4 years ago

0.1.0

4 years ago