EvanHahn / HumanizeDuration.js

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

humanizeDuration(5400000, {language: 'fr'}) -> 1.5 heures #41

Closed toutpt closed 9 years ago

toutpt commented 9 years ago

With 1.6 hours I have a good result:

humanizeDuration(moment.duration({hours: 1.6}).asMilliseconds(), { language: 'fr' }); "1 heure, 36 minutes"

But with 1.5 I have something bad: humanizeDuration(moment.duration({hours: 1.5}).asMilliseconds(), { language: 'fr' }); "1.5 heures"

Expected result is : "1 heure, 30 minutes"

toutpt commented 9 years ago

OK, after reading the code I need to pass halfUnit in the option. I believe it should be false by default.

humanizeDuration(moment.duration({hours: 1.5}).asMilliseconds(), { halfUnit: false, language: 'fr' }); "1 heure, 30 minutes"

I let you close the issue.

EvanHahn commented 9 years ago

A future version of HumanizeDuration may set halfUnit to false by default or remove it entirely, but not yet.

Closing this issue.