#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.8c91efff6bef854b7e15fcce1cb8bbb0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.