better comma placement

This commit is contained in:
Mylloon 2021-07-30 12:47:14 +02:00
parent 1f3dbcb6b6
commit e67cc0d542

View file

@ -56,7 +56,8 @@ def timestampScreen(timestamp):
def timedeltaToString(time):
"""Différence entre une heure en seconde et maintenant"""
age = str(timedelta(seconds = time)).replace('day', 'jour').replace(', ', ', :').split(':')
age = str(timedelta(seconds = time)).replace('day', 'jour').replace(', ', ':').split(':')
print(age)
if len(age) == 4:
a = [1, 1, 1, 1] # a pour affichage
if len(age) == 3:
@ -66,7 +67,7 @@ def timedeltaToString(time):
if int(age[i]) == 0:
a[i] = 0
age[0] = age[0] if a[0] == 1 else ''
age[1] = f"{age[1]}h " if a[1] == 1 else ''
age[1] = f", {age[1]}h " if a[1] == 1 else ''
age[2] = f"{age[2]}m " if a[2] == 1 else ''
age[3] = f"{age[3]}s" if a[3] == 1 else ''
return ''.join(age).strip(' ')