forum: use a more readable date format
This commit is contained in:
parent
1837f8f9a6
commit
7fc4424812
|
@ -9,9 +9,9 @@
|
|||
<td class="author">{{ widget_user.profile(c.author) }}</td>
|
||||
<td class="message">
|
||||
<div class="info">
|
||||
<div>Posté le {{ c.date_created|date }}</div>
|
||||
<div>Posté le {{ c.date_created|dyndate }}</div>
|
||||
{% if c.date_created != c.date_modified %}
|
||||
<div>Modifié le {{ c.date_modified|date }}</div>
|
||||
<div>Modifié le {{ c.date_modified|dyndate }}</div>
|
||||
{% endif %}
|
||||
<div><a href="{{ request.path }}#{{ c.id }}">Permalien</a></div>
|
||||
{# TODO: Let guests edit their posts #}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue