1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

Fix hours_ago for store

This commit is contained in:
Salamandar 2024-06-20 21:42:46 +02:00 committed by Salamandar
parent 1cf3985f55
commit e38c7401f1

View file

@ -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")