mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-24 23:11:33 +01:00
Add missing 'ago' to datetimes
This commit is contained in:
parent
6ebab36877
commit
7964f5979a
@ -2,7 +2,7 @@ from . import app, utils
|
|||||||
from .models import Permission, Package, PackageState, PackageRelease
|
from .models import Permission, Package, PackageState, PackageRelease
|
||||||
from .utils import abs_url_for, url_set_query
|
from .utils import abs_url_for, url_set_query
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from flask_babel import format_timedelta
|
from flask_babel import format_timedelta, gettext
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ def date(value):
|
|||||||
def datetime(value):
|
def datetime(value):
|
||||||
delta = dt.utcnow() - value
|
delta = dt.utcnow() - value
|
||||||
if delta.days == 0:
|
if delta.days == 0:
|
||||||
return format_timedelta(value)
|
return gettext("%(delta)s ago", delta=format_timedelta(value))
|
||||||
else:
|
else:
|
||||||
return value.strftime("%Y-%m-%d %H:%M") + " UTC"
|
return value.strftime("%Y-%m-%d %H:%M") + " UTC"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user