question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

One oddity to me is the rounding. While I can understand that

humanize.naturaltime(2*365*24*60*60 - 1)

is 1 year, 11 months ago and not 2 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 of

humanize.naturaldelta(2*365*24*60*60 - 1)

is 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 expect 102 milliseconds.

_Originally posted by @bersbersbers in https://github.com/jmoiron/humanize/issues/75#issuecomment-659220243_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
bersbersberscommented, Sep 11, 2020

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.

0reactions
hugovkcommented, May 3, 2022

🚀 Development has moved to https://github.com/python-humanize/humanize 🚀

Please open new issues at https://github.com/python-humanize/humanize/issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rounding Numbers Calculator
Round numbers to thousands, hundreds, tens, ones, tenths, hundredths and thousandths. Online calculator for rounding numbers and show steps.
Read more >
Rounding
Rounding means replacing a number with an approximate value that has a shorter, simpler, or more explicit representation. For example, replacing $23.4476 ...
Read more >
Rounding Numbers
Rounding means making a number simpler but keeping its value close to what it was. The result is less accurate, but easier to...
Read more >
Rounding Calculator
Free tool to round numbers to thousands, hundreds, tens, tenths, hundredths, fractions, or many other levels of precision using the popular rounding ......
Read more >
Math Antics - Rounding - YouTube
Learn More at mathantics.comVisit http://www.mathantics.com for more Free math videos and additional subscription based content!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found