🐛 fix: check short
value before using config date format
Added a check for whether short is true or false, rather than just
checking if it exists. This ensures that if short is set to false,
it will still use the long date format if it's available.
♻️ refactor: move the conditional around the date output, so it only
needs to check `short` once
This commit is contained in:
parent
61e288d8d5
commit
8ff86b17fc
@ -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 %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user