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:
parent
1cf3985f55
commit
e38c7401f1
1 changed files with 3 additions and 3 deletions
|
@ -94,9 +94,9 @@ def days_ago(timestamp):
|
||||||
@app.template_filter("hours_ago")
|
@app.template_filter("hours_ago")
|
||||||
def hours_ago(timestamp):
|
def hours_ago(timestamp):
|
||||||
d = datetime.now() - datetime.fromtimestamp(timestamp)
|
d = datetime.now() - datetime.fromtimestamp(timestamp)
|
||||||
hours = int(divmod(d.total_seconds(), 3600)[0])
|
minutes, _ = divmod(d.total_seconds(), 60)
|
||||||
minutes = int(divmod(d.total_seconds(), 60)[1])
|
hours, minutes = divmod(minutes, 60)
|
||||||
return f"{hours}:{minutes}h"
|
return f"{int(hours)}:{int(minutes):02d}h"
|
||||||
|
|
||||||
|
|
||||||
@app.template_filter("format_datetime")
|
@app.template_filter("format_datetime")
|
||||||
|
|
Loading…
Add table
Reference in a new issue