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 failing with float input and sub-second precision #154

Closed
antoine-gallix opened this issue Nov 9, 2023 · 0 comments · Fixed by #169
Closed

naturaldelta failing with float input and sub-second precision #154

antoine-gallix opened this issue Nov 9, 2023 · 0 comments · Fixed by #169

Comments

@antoine-gallix
Copy link

import datetime

import humanize

print(humanize.naturaldelta(datetime.timedelta(seconds=5), minimum_unit="milliseconds"))
>> 5 seconds
print(
    humanize.naturaldelta(datetime.timedelta(seconds=0.5), minimum_unit="milliseconds")
)
>> 500 milliseconds
print(humanize.naturaldelta(5, minimum_unit="milliseconds"))
>> 5 seconds
print(humanize.naturaldelta(0.5, minimum_unit="milliseconds"))
>> 0 milliseconds # !! expected "500 milliseconds"

Versions

  • OS: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
  • Python: Python 3.11.3
  • Humanize: 4.8.0
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

Successfully merging a pull request may close this issue.

1 participant