timespan
Timespan is a chainable object you can use to represent a span of time for interacting with the js Date object in node.js, and the browser.
Install via npm
npm install timespanjs
Use in browser
<script src="bin/timespan.min.js"></script>
Import into your file and create a timespan
var Timespan = ; var ts = ; //pass it a starting time var ts = 1234; //pass it another timespan object var ts1 = 1234; var ts2 = ts1;
Add time
ts; ts;
Add to a date
var date = ; date = ts; //or date;
display as a string
var ts = ; //returns '2 hours 1 minute 13 seconds' ts;
Timespan is very useful for intervals and timeouts
var everyThirtyMinutes = ; var intervalId = everyThirtyMinutes; ; var timeoutId = everyThirtyMinutes; ;