-
Notifications
You must be signed in to change notification settings - Fork 148
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
Rounding #143
Comments
I totally agree that current behavior is flawed, I had a duration of ~170 days which counts for 5.7 months, clearly something to be rounded up but it reported "5 months". |
@bersbersbers @ssbarnea Please could you have a look at #154 and see if it does the right sort of thing? Thanks! |
I will try it once it published on PyPI, but I don't have the bandwidth right now to check that PR closely. At first sight, it does make sense. |
No problem, thanks for the quick check! In case it helps, it's possible to pip install from the Git branch like this: pip install git+https://github.com/hugovk/humanize.git@naturaldelta-rounding |
That does help, thanks. A few tests that I did revealed these unexpected ones: >>> humanize.naturaldelta(2*365*24*60*60-1)
'2 years'
>>> humanize.naturaldelta(1*365*24*60*60-1)
'1 year, 364 days' I did not test further as it seems an error needs to be fixed first. |
🚀 Development has moved to https://github.com/python-humanize/humanize 🚀 Please open new issues at https://github.com/python-humanize/humanize/issues |
One oddity to me is the rounding. While I can understand that
is
1 year, 11 months ago
and not2 years ago
, because the year is not complete yet and we don't celebrate birthdays early ("how long ago was it?" - "2 years?" - "not yet!"), my intuitive expectation ofis actually
2 years
- because with deltas ("how long did it take?"), I feel rounding is much more natural.So for
101_943 / 1_000_000
, I'd probably expect102 milliseconds
.Originally posted by @bersbersbers in #75 (comment)
The text was updated successfully, but these errors were encountered: