Skip to content

A small library for creating and using time intervals using common units of time instead.

License

Notifications You must be signed in to change notification settings

knownasilya/interval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interval

A small library for creating and using time intervals using common units of time instead.

NPM
Build Status devDependency Status Coverage Status

install

npm install interval --save

usage

var interval = require('interval');

// set timeouts and intervals more literately
setTimeout(foo, interval({ hours: 2 }));

// the date 10 days from today
var deadline = interval.add(new Date(), { days: 10 });

The supported units of time are:

  • 'weeks'
  • 'days'
  • 'hours'
  • 'minutes'
  • 'seconds'
  • 'milliseconds'

You can use as many or as few units as you want and they are applied cumulatively.

interval(object)
interval.fromMilliseconds(number)
interval.normalize(object)
interval.stringify(number|object)
interval.add(date|object, object)
interval.subtract(date|object, object)

About

A small library for creating and using time intervals using common units of time instead.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published