Opened 6 years ago

Closed 6 years ago

#30443 closed New feature (duplicate)

Negative durations are displayed counterintuitively.

Reported by: Ryan Govostes Owned by:
Component: Utilities Version: dev
Severity: Normal Keywords: DurationField, duration, timedelta
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

import datetime
from django.utils.duration import duration_string

print(duration_string(datetime.timedelta(seconds=-5)))

This should print -00:00:05 but instead it prints -1 23:59:55 which is interpreted as -1 day, plus 23 hours, plus 59 minutes, plus 55 seconds.

I don't think it's intuitive to support durations that have different signs on the number of days vs hours/minutes/seconds. Note that ISO8601 timestamps just have one sign that applies to all components.

Change History (6)

comment:2 by Udbhav Govil, 6 years ago

Owner: changed from nobody to Udbhav Govil
Status: newassigned

comment:3 by Udbhav Govil, 6 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Udbhav Govil, 6 years ago

Owner: Udbhav Govil removed
Status: assignednew

comment:6 by Mariusz Felisiak, 6 years ago

Easy pickings: unset
Resolution: duplicate
Status: newclosed
Summary: Negative durations are displayed counterintuitivelyNegative durations are displayed counterintuitively.
UI/UX: unset
Version: 2.2master

Duplicate of #26317.

Note: See TracTickets for help on using tickets.
Back to Top