jintervals
jintervals copied to clipboard
Support specifying input in other units in addition to seconds
When you calculate the difference of two dates in JavaScript you will get the result in milliseconds. But jintervals expects its input in seconds, so you will have to do the converson by hand:
var milliseconds = date1 - date2;
jintervals(Math.round(milliseconds/1000), "{Hh}:{mm}");
Instead it would be better to just say to jintervals that the input is in milliseconds:
jintervals((date1-date2)+"ms", "{Hh}:{mm}");
Similarly one could use other units as input:
jintervals("24h", "{Days}");