human-duration
human-duration formats a duration as a human-readable duration, like 2d 6h
. There are other utilities similar to this, but this one aims to be compact (standing at 600 bytes), entirely configurable, and usable with internationalization.
Installation
npm install --save human-duration
Usage
See the test cases for quick usage examples.
const duration = duration // => '1s'duration // => '1m 30s'duration // => '1h 10m 13s'duration // => '1d 7h 10m 13s' duration // => '1d 7h'duration // => '1d:7h:0m:0s'duration // => '0m 30h'duration // => '1s and 8 jiffies'