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

naturaldelta should not round down the months #186

Closed
luisgc93 opened this issue Dec 19, 2020 · 4 comments
Closed

naturaldelta should not round down the months #186

luisgc93 opened this issue Dec 19, 2020 · 4 comments

Comments

@luisgc93
Copy link

luisgc93 commented Dec 19, 2020

I've noticed this is the same issue as #116 but didn't find any discussion on why it was closed or why the current implementation is favoured. Apologies if this is somehow redundant.

What did you do?

humanize.naturaldelta(datetime.date(2021, 3, 13) - datetime.date(2020, 12, 13))

What did you expect to happen?

I would expect the result to be "3 months"

What actually happened?

The result was "2 months"

What versions are you using?

  • OS: macOS Catalina 10.15.7
  • Python: 3.8
  • Humanize: 3.2.0
from datetime import date
import humanize

time_difference = humanize.naturaldelta(date(2021, 3, 13) - date(2020, 12, 13)

assert time_difference == "3 months"

I'd be happy to make the relevant changes. Thanks in advance for any feedback!

@hugovk
Copy link
Collaborator

hugovk commented Dec 19, 2020

I'm not sure why #116 was closed, the reporter later deleted their account too. Anyway, is this a duplicate of #143?

I had started on a PR for that one (#154), but unfortunately I let it stall and it probably needs some refactoring. Anyway, I'd be happy if you'd like to take a look into it!

Feel free to use any of that PR, or just start afresh. At least, the test cases may be handy, and see the comments in #143 too.

Thanks!

@luisgc93
Copy link
Author

I've taken a look at your PR, I like your approach. It also fixes the example I've outlined. Do I need write access permissions to make any changes?

@hugovk
Copy link
Collaborator

hugovk commented Dec 20, 2020

Please create a branch from mine into your own fork, and then create a fresh PR. Thanks!

@hugovk
Copy link
Collaborator

hugovk commented May 3, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants