diff --git a/app/__init__.py b/app/__init__.py index 035bb2a9b..a3e22afbd 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -279,12 +279,15 @@ def format_date_short(date): def format_delta(date): + delta = ( + datetime.now(timezone.utc) + ) - ( + gmt_timezones(date) + ) + if delta < timedelta(seconds=30): + return "just now" return ago.human( - ( - datetime.now(timezone.utc) - ) - ( - dateutil.parser.parse(date) - ), + delta, future_tense='{} from now', # No-one should ever see this past_tense='{} ago', precision=1 diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index f18226a98..b1f827535 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -24,7 +24,7 @@ {% if template._template.updated_at %}
-

Last edited {{ template._template.updated_at|format_datetime_relative }}

+

Last edited {{ template._template.updated_at|format_delta }}

See previous versions