From fcc445de9f15648347aa9691e8126f382dd90d20 Mon Sep 17 00:00:00 2001 From: Chris Lawton <chris.lawton@torchbox.com> Date: Fri, 10 May 2019 10:00:57 +0100 Subject: [PATCH] parse the edited date --- .../activity/templates/activity/include/listing_base.html | 2 +- opentech/static_src/src/javascript/apply/edit-comment.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/opentech/apply/activity/templates/activity/include/listing_base.html b/opentech/apply/activity/templates/activity/include/listing_base.html index 2d2e7bdaf..763e6e611 100644 --- a/opentech/apply/activity/templates/activity/include/listing_base.html +++ b/opentech/apply/activity/templates/activity/include/listing_base.html @@ -14,7 +14,7 @@ </a> </p> {% if activity.edited %} - <p class="feed__meta-item feed__meta-item--last-edited">(Last edited: <span class="js-last-edited">{{ activity.edited }}</span>)</p> + <p class="feed__meta-item feed__meta-item--last-edited">(Last edited: <span class="js-last-edited">{{ activity.edited|date:"Y-m-d H:i" }}</span>)</p> {% endif %} {% if activity.private %} <p class="feed__meta-item feed__meta-item--right"> diff --git a/opentech/static_src/src/javascript/apply/edit-comment.js b/opentech/static_src/src/javascript/apply/edit-comment.js index 4be1f999a..509bd2361 100644 --- a/opentech/static_src/src/javascript/apply/edit-comment.js +++ b/opentech/static_src/src/javascript/apply/edit-comment.js @@ -97,9 +97,11 @@ $(el).closest(editBlock).siblings(comment).show(); }; - // TODO - parse date const updateLastEdited = (el, date) => { - $(el).closest(feedContent).find(lastEdited).html(date); + const parsedDate = new Date(date).toISOString().split('T')[0]; + const time = new Date(date).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}); + + $(el).closest(feedContent).find(lastEdited).html(`${parsedDate} ${time}`); }; const updateComment = (el, id, newComment) => { -- GitLab