Skip to content

aleclarson/ago

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ago v1.1.0 stable

ago = require "ago"

# Get a Number representing one day ago (in milliseconds)
ms = ago 1, "d"

# Get a Number representing one day in the future (in milliseconds)
ago.fromNow 1, "d"

# Convert the Number to a Date
date = new Date ms

# Get the difference between a Date and the current time (in milliseconds)
ago date

# Convert the Number to a String
ago.toString ms

# Convert the Date to a String
ago.toString date

 

details

  • ms, s, m, h, d, w, mo, and y are the valid units.

  • Years and months are approximated.

  • Rounding always uses Math.floor.

 

install

npm install aleclarson/ago#1.0.0

About

Relative timestamps for Javascript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 100.0%