python-humanize / humanize

Python humanize functions
https://humanize.readthedocs.io
MIT License
458 stars 61 forks source link

`humanize.naturaldelta()` always rounds down #174

Open qtlunya opened 6 months ago

qtlunya commented 6 months ago

What did you do?

humanize.naturaldelta(10799)

Note that this is exactly one second below 3 hours.

What did you expect to happen?

It should say 3 hours.

What actually happened?

It says 2 hours.

What versions are you using?

Please include code that reproduces the issue.

The best reproductions are self-contained scripts with minimal dependencies.

print(humanize(10800))  # "3 hours"
print(humanize(10799))  # "2 hours"
hugovk commented 6 months ago

Previously reported at the old repo:

But those are closed, so we let's use this new issue.

There's an old PR that started work to fix this, but was never finished: