Install
npm install format-duration
Usage
const 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 })
format(999, { ms: true })
format(1000 * 60, { ms: true })
format(1000 * 60 * 60 * 24 - 1, { ms: true })
Contributing
Contributions welcome! Please read the contributing guidelines first.
License
ISC
Stopwatch image is from emojidex.