mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-18 09:24:52 +00:00
Add a timeago filter
This commit is contained in:
parent
1ebe97a41c
commit
961759e40b
2 changed files with 7 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import datetime
|
||||
import timeago
|
||||
from flask import Blueprint
|
||||
|
||||
|
||||
|
@ -11,3 +12,8 @@ def format_result(dttm):
|
|||
time = datetime.timedelta(seconds=int(dttm[0]))
|
||||
microtime = dttm[1][:3]
|
||||
return f"{time}:{microtime}"
|
||||
|
||||
|
||||
@blueprint.app_template_filter()
|
||||
def timesince(dttm):
|
||||
return timeago.format(dttm, datetime.datetime.now())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue