1.2.0 • Published 9 years ago

timelabel v1.2.0

Weekly downloads
89
License
MIT
Repository
github
Last release
9 years ago

timelabel Build Status js-standard-style

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 = require('timelabel')

// milliseconds
timelabel(150) // '150 milliseconds'

// seconds
timelabel(2400) // '2 seconds'

// minutes
timelabel(200000) // '3 minutes'
timelabel(200000, true) // '3m 20s'

// hours
timelabel(38000000) // '11 hours'
timelabel(38000000, true) // '10h 33m'

// days
timelabel(3810000000) // '44 days'
timelabel(3810000000, true) // '44d 2h'

License

MIT

1.2.0

9 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago