Skip to content

Commit 261d2a8

Browse files
committed
add short date filter for notes
1 parent df6f1ec commit 261d2a8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

application/factory.py

+2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ def register_filters(app):
6363
choice_to_list_filter,
6464
map_to_tag_class_filter,
6565
render_markdown_filter,
66+
short_date_filter,
6667
slugify_filter,
6768
)
6869

6970
app.add_template_filter(choice_to_list_filter, "choice_to_list")
7071
app.add_template_filter(slugify_filter, "slugify")
7172
app.add_template_filter(map_to_tag_class_filter, "map_to_tag_class")
7273
app.add_template_filter(render_markdown_filter, "render_markdown")
74+
app.add_template_filter(short_date_filter, "short_date")
7375

7476
from digital_land_frontend.filters import commanum_filter
7577

application/filters.py

+6
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ def _add_html_attrs(soup):
5959
tag["class"] = "govuk-section-break govuk-section-break--l"
6060
for tag in soup.select("code"):
6161
tag["class"] = "app-code"
62+
63+
64+
def short_date_filter(date):
65+
if date is None:
66+
return ""
67+
return date.strftime("%d %B %Y")

application/templates/consideration.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ <h2 class="govuk-heading-l">Notes</h2>
274274
{% for note in consideration.notes %}
275275
{% if not note.deleted_date %}
276276
<li>
277-
<span class="govuk-!-font-size-14">{{ note.author }} (created: {{ note.created }})</span>
277+
<span class="govuk-!-font-size-14">{{ note.author }} (created: {{ note.created | short_date}})</span>
278278
<div class="app-note__content">{{ note.text|render_markdown }}</div>
279279
<div class="app-note__actions">
280280
<span class="govuk-!-font-size-14">

0 commit comments

Comments
 (0)