hd

humanized-duration

Display durations in short yet human readable way.

Showing:

Popularity

Downloads/wk

22

GitHub Stars

0

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

0

License

GPL-2.0-only

Type Definitions

Tree-Shakeable

No?

Categories

Readme

humanized-duration

Display durations in short yet human readable way.

How to install

npm

npm install humanized-duration

bower

bower install humanized-duration

How to use

NodeJS

var humanized_duration = require('humanized-duration');

Browser

var humanized_duration = window.humanized_duration;

Examples

humanized_duration(59 * 1000) // 59s
humanized_duration(60 * 1000) // 1m

humanized_duration((58 * 60 + 59) * 1000) // 58m 59s
humanized_duration((58 * 60 + 60) * 1000) // 59m

humanized_duration((59 * 60 + 59) * 1000) // 59m 59s
humanized_duration((59 * 60 + 60) * 1000) // 1h

humanized_duration((6 * 24 * 60 * 60 + 23 * 60 * 60 + 59 * 60 + 59) * 1000) // 6d 23h
humanized_duration((6 * 24 * 60 * 60 + 23 * 60 * 60 + 59 * 60 + 60) * 1000) // 1w

humanized_duration((5 * 24 * 60 * 60 + 23 * 60 * 60 + 59 * 60 + 59) * 1000, 3) // 5d 23h 59m
humanized_duration((6 * 24 * 60 * 60 + 23 * 60 * 60 + 59 * 60 + 59) * 1000, 4) // 6d 23h 59m 59s

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100