mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-14 14:22:16 +00:00
Add a timeago filter
This commit is contained in:
parent
1ebe97a41c
commit
961759e40b
2 changed files with 7 additions and 0 deletions
|
@ -11,3 +11,4 @@ Flask-Caching
|
|||
libsass-bin
|
||||
jsmin
|
||||
cssmin
|
||||
timeago
|
||||
|
|
|
@ -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
Reference in a new issue