From a0c5c63616b2ccffcc5a798d8e9ecaf23d49bb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 20 Jun 2024 21:42:46 +0200 Subject: [PATCH] Fix hours_ago for store --- store/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/store/app.py b/store/app.py index 3862c0085..caac42783 100644 --- a/store/app.py +++ b/store/app.py @@ -94,9 +94,9 @@ def days_ago(timestamp): @app.template_filter("hours_ago") def hours_ago(timestamp): d = datetime.now() - datetime.fromtimestamp(timestamp) - hours = int(divmod(d.total_seconds(), 3600)[0]) - minutes = int(divmod(d.total_seconds(), 60)[1]) - return f"{hours}:{minutes}h" + minutes, _ = divmod(d.total_seconds(), 60) + hours, minutes = divmod(minutes, 60) + return f"{int(hours)}:{int(minutes):02d}h" @app.template_filter("format_datetime")