Use friendlier relative dates for ‘last edited’

Because ‘2 months ago’ is more human-sounding than ‘70 days ago’.

Using this pattern (borrowed from the API integration page) will also
use Javascript to keep the time updated, so ‘just now’ will turn into
‘1 minute ago’ without having to reload the page.
This commit is contained in:
Chris Hill-Scott
2018-09-06 16:19:41 +01:00
parent 72ca78e824
commit c76b865d88

View File

@@ -57,7 +57,13 @@
<div class="bottom-gutter-1-2">
{% if template._template.updated_at %}
<h2 class="heading-small bottom-gutter-2-3 heading-inline">Last edited {{ template._template.updated_at|format_delta }}</h2>
<h2 class="heading-small bottom-gutter-2-3 heading-inline">
Last edited
<time class="timeago" datetime="{{ template._template.updated_at }}">
{{ template._template.updated_at|format_delta }}
</time>
</h2>
&emsp;
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
&emsp;