JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1767
  • Score
    100M100P100Q101524F

Javascript module for outputting relative dates.

Package Exports

  • relative-date

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (relative-date) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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