duratiform

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

npm install duratiform
2 downloads in the last week
4 downloads in the last month

duratiform

NPM version

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

Installation

Node

npm install duratiform

Component

component install gamtiq/duratiform

Jam

jam install duratiform

Bower

bower install duratiform

AMD, <script>

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

Usage

Node, Component

var duratiform = require("duratiform");

Jam

require(["duratiform"], function(duratiform) {
    ...
});

AMD

define(["path/to/dist/duratiform.js"], function(duratiform) {
    ...
});

Bower, <script>

<!-- 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>

Example

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.

API

See doc folder.

License

MIT

npm loves you