diff --git a/app/templates/widgets/thread.html b/app/templates/widgets/thread.html index 64e1405..9635acf 100644 --- a/app/templates/widgets/thread.html +++ b/app/templates/widgets/thread.html @@ -9,9 +9,9 @@ {{ widget_user.profile(c.author) }}
-
Posté le {{ c.date_created|date }}
+
Posté le {{ c.date_created|dyndate }}
{% if c.date_created != c.date_modified %} -
Modifié le {{ c.date_modified|date }}
+
Modifié le {{ c.date_modified|dyndate }}
{% endif %}
Permalien
{# TODO: Let guests edit their posts #} diff --git a/app/utils/filters/date.py b/app/utils/filters/date.py index 22b140c..8edfbe6 100644 --- a/app/utils/filters/date.py +++ b/app/utils/filters/date.py @@ -13,8 +13,8 @@ def filter_date(date, format="%Y-%m-%d à %H:%M"): "Août", "Septembre", "Octobre", "Novembre","Décembre"] \ [date.month - 1] - # Omit current year in the dynamic format - if date.year == datetime.now().year: + # Omit current year in the last 8 months + if (date - datetime.now()).days <= 8 * 30: format = f"{d} {m} à %H:%M" else: format = f"{d} {m} %Y à %H:%M"