timespanjs

create timespans objects for using with native js dates

timespan

Timespan is a chainable object you can use to create timespans for interacting with the js Date object in node.js.

Import into your file and create a timespan

   var Timespan = require('./timespan');
   var ts = new Timespan();

Add time

   ts.addMinute(1);
   ts.addSecond(2).addHour(3).addDay(4);

Add to a date

 
   var date = new Date();
   date = ts.addToDate(date);
 
   //or 
   date.addTimespan(ts);
 

Timespan is very for intervals and timeouts

    var everyThirtyMinutes = new Timespan().addMinutes(30);
    setInterval(func,everyThirtyMinutes.span);