duratiform

Utility to separate into parts and to format time duration in milliseconds

duratiform

Utility to separate into parts and to format time duration in milliseconds.

npm install duratiform

Component

component install gamtiq/duratiform

Jam

jam install duratiform

Bower

bower install duratiform

Use dist/duratiform.js or dist/duratiform.min.js (minified version).

var duratiform = require("duratiform");
require(["duratiform"], function(duratiform) {
    ...
});
define(["path/to/dist/duratiform.js"], function(duratiform) {
    ...
});
<!-- Use bower_components/duratiform/dist/duratiform.js if the library was installed by Bower -->
<script type="text/javascript" src="path/to/dist/duratiform.js"></script>
<script type="text/javascript">
    // duratiform is available via duratiform field of window object 
    ...
</script> 
var nDuration = 123456789000;
console.log("Duration parts: ", duratiform.divide(nDuration, 4));
console.log(nDuration, " - ", duratiform.format(nDuration, "d [days] h [hours] m [minutes] s [seconds]"));

See test/duratiform.js for additional examples.

See doc folder.

MIT