timelabel
Convert time lengths (intervals) into a nice formatted string.
Installation
$ npm install timelabel
Test:
$ npm test
Usage/API
timelabel(number, [detail])
The function takes a number as its only required argument, assuming the number is a millisecond length and converts longer lengths it to a nicer format. If the detail
argument is set to true then it will return more detail. See examples below.
Examples:
var timelabel = // milliseconds // '150 milliseconds' // seconds // '2 seconds' // minutes // '3 minutes' // '3m 20s' // hours // '11 hours' // '10h 33m' // days // '44 days' // '44d 2h'
License
MIT