Skip to content

naturaldelta with negative seconds loses precision and doesn't match naturaltime #18

Description

@Dapid

What did you do?

I passed a small negative integer value to naturaldelta, it reports "a day".

What did you expect to happen?

I expect naturaldelta to roughly match naturaltime. Else, if negative values are not supported, it should be documented.

What actually happened?

import humanize

print(humanize.naturaldelta(-1))
print(humanize.naturaltime(-1))

shows:

a day
a second ago

What versions are you using?

  • OS: Linux LCARS2 5.17.4-200.fc35.x86_64 #1 SMP PREEMPT Wed Apr 20 15:37:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Python: 3.9.12
  • Humanize: 4.1.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions