From 8ff86b17fc3b26f63abb9870a73f73c7606cc557 Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 18 Mar 2023 02:05:16 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20check=20`short`=20value?= =?UTF-8?q?=20before=20using=20config=20date=20format=20Added=20a=20check?= =?UTF-8?q?=20for=20whether=20short=20is=20true=20or=20false,=20rather=20t?= =?UTF-8?q?han=20just=20checking=20if=20it=20exists.=20This=20ensures=20th?= =?UTF-8?q?at=20if=20short=20is=20set=20to=20false,=20it=20will=20still=20?= =?UTF-8?q?use=20the=20long=20date=20format=20if=20it's=20available.=20?= =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20move=20the=20conditional=20aro?= =?UTF-8?q?und=20the=20date=20output,=20so=20it=20only=20needs=20to=20chec?= =?UTF-8?q?k=20`short`=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/macros/format_date.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/macros/format_date.html b/templates/macros/format_date.html index a487484..6133281 100644 --- a/templates/macros/format_date.html +++ b/templates/macros/format_date.html @@ -1,8 +1,8 @@ {% macro format_date(date, short) %} -{% if config.extra.short_date_format %} +{% if config.extra.short_date_format and short %} {{ date | date(format=config.extra.short_date_format) }} -{% elif config.extra.long_date_format %} +{% elif config.extra.long_date_format and not short %} {{ date | date(format=config.extra.long_date_format) }} {% else %} {% set day = date | date(format='%-d') | int %} @@ -23,10 +23,11 @@ {% endif %} {# Return the date. #} + {{ date | date(format="%-d") }}{{ suffix }} {% if short == true %} - {{ date | date(format="%-d") }}{{ suffix }} {{ date | date(format="%b %Y") }} + {{ date | date(format="%b %Y") }} {% else %} - {{ date | date(format="%-d") }}{{ suffix }} {{ date | date(format="%B %Y") }} + {{ date | date(format="%B %Y") }} {% endif %} {% endif %}