format-duration
Convert a number in milliseconds to a standard duration string.
Install
npm install format-duration
Usage
var format = require('format-duration')
format(999)
format(1000)
format(1000 * 2 - 1)
format(1000 * 60)
format(1000 * 60 - 1)
format(1000 * 60 * 60)
format(1000 * 60 * 60 - 1)
format(1000 * 60 * 60 * 24)
format(1000 * 60 * 60 * 24 - 1)
format(1000 * 60 * 60 * 24 * 365)
format(-999)
format(-1000)
format(-1000 * 60 * 60 * 24 * 365)
format(1000 * 60, { leading: true })
format(1000 * 60 - 1, { leading: true })
format(1000 * 60 * 60, { leading: true })
Contributing
Contributions welcome! Please read the contributing guidelines first.
License
ISC