do not fail if None is passed to formatDuration
This commit is contained in:
parent
4631911462
commit
b70005010d
1 changed files with 2 additions and 0 deletions
|
@ -174,6 +174,8 @@ def formatDuration(ms, verbosity=0, years=True, hours=True, milliseconds=True):
|
||||||
>>> formatDuration(1000 * 30, hours=False, milliseconds=False)
|
>>> formatDuration(1000 * 30, hours=False, milliseconds=False)
|
||||||
'00:30'
|
'00:30'
|
||||||
'''
|
'''
|
||||||
|
if not ms:
|
||||||
|
return ''
|
||||||
if years:
|
if years:
|
||||||
y = int(ms / 31536000000)
|
y = int(ms / 31536000000)
|
||||||
d = int(ms % 31536000000 / 86400000)
|
d = int(ms % 31536000000 / 86400000)
|
||||||
|
|
Loading…
Reference in a new issue