Socket
Socket
Sign inDemoInstall

relative-date

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    relative-date

Javascript module for outputting relative dates.


Version published
Maintainers
1
Install size
6.11 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 23 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc