#33349: Add option to produce duration_string without days
------------------------------+--------------------------------------
Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => wontfix
Comment:
Thanks for this ticket, however `duration_string` is a private
undocumented API and I don't think that adding a new option is justified
here. You can also re-use `_get_duration_components` to simplify your
implementation, e.g.:
{{{
def custom_duration_string(duration):
days, hours, minutes, seconds, microseconds =
_get_duration_components(duration)
if days:
hours += days * 24
string = '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds)
if microseconds:
string += '.{:06d}'.format(microseconds)
return string
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33349#comment:1>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.7114db5bdc835e6479b5e310707a8e2c%40djangoproject.com.