Skip to content
Snippets Groups Projects
Commit dbdd18af authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

update timedelta to better handle days and the "x and" type strings

parent f3e00f33
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,13 @@ def timedelta(delta):
# currently use the humanize module to do this
t = humanize.time.precisedelta(dt.timedelta(seconds=delta),format='%0.2f',minimum_unit='milliseconds',suppress=['milliseconds'])
# and use more compact units
t = t.replace(" days and","d")
t = t.replace(" hours and","h")
t = t.replace(" minutes and","m")
t = t.replace(" seconds and","s")
t = t.replace(" days","d")
t = t.replace(" hours","h")
t = t.replace(" minutes","m")
t = t.replace(" seconds","s")
return t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment