This package has been deprecated

Author message:

Development of this module has been stopped.

timelabel

1.2.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i timelabel

Weekly Downloads

17

Version

1.2.0

License

MIT

Last publish

Collaborators

  • roryrjb