EvanHahn / HumanizeDuration.js

361000 becomes "6 minutes, 1 second"
https://evanhahn.github.io/HumanizeDuration.js/
The Unlicense
1.64k stars 175 forks source link

Added the significance funtionality. #75

Closed TioNoob closed 9 years ago

TioNoob commented 9 years ago

This functionality was implemented for when we don't know what numbers will come (they can be big or small numbers), but is needed to show just the "X" most significant numbers. It's recommended use together with "round".

EvanHahn commented 9 years ago

Turns out that we already had this feature under a different name, and I totally forgot to document it.

humanizeDuration(1000000000000)                  // 31 years, 8 months, 1 week, 19 hours, 46 minutes, 40 seconds
humanizeDuration(1000000000000, { largest: 2 })  // 31 years, 8 month

Updated the README with this change. Thanks for reminding me to document it!