enable localised dates

This commit is contained in:
Hugh Rundle 2024-09-18 19:40:44 +10:00
parent a61ca162b0
commit dd45823790
No known key found for this signature in database
GPG key ID: A7E35779918253F9

View file

@ -1,6 +1,7 @@
""" template filters """
from dateutil.relativedelta import relativedelta
from django import template
from django.conf import settings
from django.contrib.humanize.templatetags.humanize import naturaltime, naturalday
from django.template.loader import select_template
from django.utils import timezone
@ -61,7 +62,7 @@ def get_published_date(date):
if delta.years:
return naturalday(date)
if delta.days or delta.months:
return naturalday(date, "M j")
return naturalday(date, settings.MONTH_DAY_FORMAT)
return naturaltime(date)