Skip to content

precisedelta unusual results when rounding #30

@ralkire

Description

@ralkire

What did you do?

If I pass 32399 seconds to precisedelta (8 hours 59 minutes 59 seconds) and set minimum time to minutes, it does not round up to hours. That is, it will round 59 minutes 59 seconds to 60 minutes but doesn't take the step further to round 60 minutes to hours.

What did you expect to happen?

'9 hours'

What actually happened?

'8 hours and 60 minutes'

What versions are you using?

  • OS: Debian 4.19
  • Python: 3.73
  • Humanize: 4.22

Please include code that reproduces the issue.

import humanize
humanize.precisedelta(32399, minimum_unit='minutes', format='%0.0f')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions