Skip to content

Commit

Permalink
Fix hours_ago for store
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Jun 20, 2024
1 parent 1cf3985 commit a0c5c63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions store/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a0c5c63

Please sign in to comment.