Narcissistic Preening Monarch
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    relative-datepublic

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

    Install

    npm install relative-date

    Usage

    On browsers:

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

    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'

    Testing

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

    install

    npm i relative-date

    Downloadslast 7 days

    1,330

    version

    1.1.3

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar