mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 18:18:26 -04:00
Merge pull request #1216 from alphagov/88mph
Fix future ‘last edited’ date
This commit is contained in:
@@ -279,12 +279,15 @@ def format_date_short(date):
|
|||||||
|
|
||||||
|
|
||||||
def format_delta(date):
|
def format_delta(date):
|
||||||
|
delta = (
|
||||||
|
datetime.now(timezone.utc)
|
||||||
|
) - (
|
||||||
|
gmt_timezones(date)
|
||||||
|
)
|
||||||
|
if delta < timedelta(seconds=30):
|
||||||
|
return "just now"
|
||||||
return ago.human(
|
return ago.human(
|
||||||
(
|
delta,
|
||||||
datetime.now(timezone.utc)
|
|
||||||
) - (
|
|
||||||
dateutil.parser.parse(date)
|
|
||||||
),
|
|
||||||
future_tense='{} from now', # No-one should ever see this
|
future_tense='{} from now', # No-one should ever see this
|
||||||
past_tense='{} ago',
|
past_tense='{} ago',
|
||||||
precision=1
|
precision=1
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
{% if template._template.updated_at %}
|
{% if template._template.updated_at %}
|
||||||
<div class="bottom-gutter-2">
|
<div class="bottom-gutter-2">
|
||||||
<h2 class="heading-small">Last edited {{ template._template.updated_at|format_datetime_relative }}</h2>
|
<h2 class="heading-small">Last edited {{ template._template.updated_at|format_delta }}</h2>
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
|
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user