Fix countdown being broken when only seconds are left

This commit is contained in:
2022-12-15 01:48:19 +01:00
parent f0f1339555
commit de5823d104

View File

@ -58,6 +58,11 @@ def countdown(trigger_time: datetime) -> str:
countdown_time.seconds // 60 % 60, countdown_time.seconds // 60 % 60,
) )
# Return seconds if only seconds are left.
if days == 0 and hours == 0 and minutes == 0:
seconds = countdown_time.seconds % 60
return f"{seconds} second" + ("s" if seconds != 1 else "")
# TODO: Explain this. # TODO: Explain this.
return ", ".join( return ", ".join(
f"{x} {y}{'s' * (x != 1)}" f"{x} {y}{'s' * (x != 1)}"