EvanHahn / HumanizeDuration.js

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

Hide "number of units" when 1 #202

Closed PeterKottas closed 3 years ago

PeterKottas commented 3 years ago

Apologies if this was asked before, but it's quite vaguely defined and my searches didn't yield results.

Is there a way to achieve:

humanizeDuration(3600000); => // 'hour' or 'an hour'
// instead of what it currently returns:
humanizeDuration(3600000); => // '1 hour'

This applies to all units, I understand it would require big changes in localization files. Not a big deal, just curious.

Thanks

EvanHahn commented 3 years ago

I don't believe this is possible, unfortunately. Because this library is in maintenance mode, I don't plan to add a feature like this, but I'm happy to endorse a fork or add some documentation if you figure out a way to do this!

PeterKottas commented 3 years ago

Fair enough! Thanks for the info.