Fix issue when scheduled datetime is passed

This commit is contained in:
Gabriel Augendre 2021-12-04 17:08:25 +01:00
parent d604842cfc
commit 5920dfc822

View file

@ -112,6 +112,8 @@ async def stop(
def get_delai(heure_passage: str) -> str:
dt = datetime.strptime(heure_passage, "%Y-%m-%d %H:%M:%S")
now = datetime.now()
if now > dt:
return "Proche"
delai = dt - now
minutes = delai.seconds // 60
if minutes <= 0: