fixed a problem that mixed timings

This commit is contained in:
Mylloon 2021-08-18 21:49:56 +02:00
parent ed7885eb54
commit e28587fee9

View file

@ -75,13 +75,17 @@ def timedeltaToString(time):
week = f"{week} semaine{'s' if week > 1 else ''}" if week > 0 else "" week = f"{week} semaine{'s' if week > 1 else ''}" if week > 0 else ""
day = f"{day} jour{'s' if day > 1 else ''}" if day > 0 else "" day = f"{day} jour{'s' if day > 1 else ''}" if day > 0 else ""
_ageTemp = [year, week, day] _ageTemp = [year, week, day]
age[0] = ', '.join(list(set(_ageTemp) - {""})).strip(' ') while "" in _ageTemp:
_ageTemp.remove("")
age[0] = ', '.join(_ageTemp).strip(' ')
else: else:
age[0] = "" age[0] = ""
age[1] = f"{age[1]}h" if affichage[1] == 1 else "" age[1] = f"{age[1]}h" if affichage[1] == 1 else ""
age[2] = f"{age[2]}m" if affichage[2] == 1 else "" age[2] = f"{age[2]}m" if affichage[2] == 1 else ""
age[3] = f"{age[3]}s" if affichage[3] == 1 else "" age[3] = f"{age[3]}s" if affichage[3] == 1 else ""
return ', '.join(list(set(age) - {""})).strip(' ') while "" in age:
age.remove("")
return ', '.join(age).strip(' ')
def getAge(date): def getAge(date):
"""Décompose la différence entre une date et maintenant avec les bons timezone""" """Décompose la différence entre une date et maintenant avec les bons timezone"""