timeago-words

0.0.3 • Public • Published

timeago

make your dates looks like facebook/twitter.

timeago

install

npm install timeago-words

or from your package.json file:

"dependencies": { "timeago-words": "x" }

usage

var timeago = require('timeago-words');
 
timeago(someDate); //"x days ago"
timeago.settings; //will desplay all settings you can edit
 

make sure someDate is a Date object.

You can also use it in Express app templates:

var app = express.createServer();
 
app.helpers({
  timeago: require('timeago-words')
});
<div class="timeago"><%- timeago(widget.created) %></div>

to use custom language:

  timeago(someDate, 'pt')

Readme

Keywords

Package Sidebar

Install

npm i timeago-words

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • sagivo