Javascript module for outputting relative dates.
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Latest commit b6ceb19 Feb 26, 2015
Failed to load latest commit information.
lib remove today msg Jun 7, 2011
test [fix] Changed require('util') to require('util') for compatibility wi… Jun 24, 2012
COPYING add license Oct 17, 2011 update readme Jul 23, 2012
package.json 1.1.2 Feb 26, 2015

Javascript module for outputting relative dates. Tested platforms: Node, Firefox 3.6, Chromium 8.0


npm install relative-date


On browsers:

<script src="relative-date.js"></script>
  assert( relativeDate(new Date()), 'just now' );
  assert( relativeDate(1299627946000), '12 minutes ago');
  assert( relativeDate(0), '41 years ago');

On a CommonJS compliant environment:

> var relativeDate = require('relative-date');
> relativeDate(new Date())
'just now'
> relativeDate(1299627946000)
'12 minutes ago'
> relativeDate(0)
'41 years ago'


node test/node.js || test/browser.html