Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

humanize.naturaldelta() always rounds down #174

Open
lunaynx opened this issue Feb 25, 2024 · 3 comments
Open

humanize.naturaldelta() always rounds down #174

lunaynx opened this issue Feb 25, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@lunaynx
Copy link

lunaynx commented Feb 25, 2024

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?

  • OS: Debian 12
  • Python: 3.11.2
  • Humanize: 4.9.0

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
Copy link
Member

hugovk commented Feb 25, 2024

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:

@hugovk hugovk added the help wanted Extra attention is needed label Oct 5, 2024
@mmarras
Copy link

mmarras commented Jan 7, 2025

Just ran into this, too. precisedelta(mydtime) -> '12 hours, 51 minutes and 44.17 seconds' naturaldelta(mydtime) -> '12 hours'. 🤐

@hugovk I'd possibly be motivated to pick this up. What's still needed over the old solution?

@hugovk
Copy link
Member

hugovk commented Jan 7, 2025

@mmarras That would be great! I don't remember by now, jmoiron/humanize@a75d18c was the main commit, the others in the PR were mostly cosmetic and some have already been applied. At least the Unit -> _Unit renaming should be skipped. And it might be better with a fresh start, but feel free to take anything useful, like the tests might be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants