[Django] #30443: Negative durations are displayed counterintuitively

5 views
Skip to first unread message

Django

unread,
May 4, 2019, 1:43:06 PM5/4/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan | Owner: nobody
Govostes |
Type: New | Status: new
feature |
Component: Utilities | Version: 2.2
Severity: Normal | Keywords: DurationField,
Triage Stage: | duration, timedelta
Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
-------------------------------------+-------------------------------------
{{{
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/30443>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 4, 2019, 1:47:22 PM5/4/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 2.2
Severity: Normal | Resolution:

Keywords: DurationField, | Triage Stage:
duration, timedelta | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Ryan Govostes):

https://github.com/django/django/pull/11321

--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:1>

Django

unread,
May 5, 2019, 5:35:45 AM5/5/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner:
| udbhavgovil
Type: New feature | Status: assigned
Component: Utilities | Version: 2.2
Severity: Normal | Resolution:

Keywords: DurationField, | Triage Stage:
duration, timedelta | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by udbhavgovil):

* status: new => assigned
* owner: nobody => udbhavgovil


--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:2>

Django

unread,
May 5, 2019, 7:07:07 AM5/5/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner:
| udbhavgovil
Type: New feature | Status: assigned
Component: Utilities | Version: 2.2
Severity: Normal | Resolution:
Keywords: DurationField, | Triage Stage: Accepted
duration, timedelta |

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by udbhavgovil):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:3>

Django

unread,
May 5, 2019, 7:57:02 AM5/5/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner: (none)

Type: New feature | Status: new
Component: Utilities | Version: 2.2

Severity: Normal | Resolution:
Keywords: DurationField, | Triage Stage: Accepted
duration, timedelta |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by udbhavgovil):

* status: assigned => new
* owner: udbhavgovil => (none)


--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:4>

Django

unread,
May 5, 2019, 7:59:43 AM5/5/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively
-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner: (none)
Type: New feature | Status: new
Component: Utilities | Version: 2.2

Severity: Normal | Resolution:
Keywords: DurationField, | Triage Stage: Accepted
duration, timedelta |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by udbhavgovil):

https://github.com/django/django/pull/11326

--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:5>

Django

unread,
May 6, 2019, 12:58:38 AM5/6/19
to django-...@googlegroups.com
#30443: Negative durations are displayed counterintuitively.

-------------------------------------+-------------------------------------
Reporter: Ryan Govostes | Owner: (none)
Type: New feature | Status: closed
Component: Utilities | Version: master
Severity: Normal | Resolution: duplicate

Keywords: DurationField, | Triage Stage: Accepted
duration, timedelta |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* version: 2.2 => master
* easy: 1 => 0
* ui_ux: 1 => 0
* resolution: => duplicate


Comment:

Duplicate of #26317.

--
Ticket URL: <https://code.djangoproject.com/ticket/30443#comment:6>

Reply all
Reply to author
Forward
0 new messages