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:1 by , 6 years ago
comment:2 by , 6 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 6 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 6 years ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
comment:6 by , 6 years ago
| Easy pickings: | unset |
|---|---|
| Resolution: | → duplicate |
| Status: | new → closed |
| Summary: | Negative durations are displayed counterintuitively → Negative durations are displayed counterintuitively. |
| UI/UX: | unset |
| Version: | 2.2 → master |
Duplicate of #26317.
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/11321