minetestblog.github.io/_includes/utils/date_custom_short.html
2022-01-22 18:49:09 -05:00

22 lines
903 B
HTML

{% if include.date %}
{% assign processed_date = include.date %}
{% else if page.date %}
{% assign processed_date = page.date %}
{% endif %}
{% comment %}-------- Test if we have a date to process --------{% endcomment %}
{% if processed_date %}
{% assign month = "January,February,March,April,May,June,July,August,September,October,November,December" | split: "," %}
{% assign month_index = processed_date | date: "%m" | minus: 1 %}
{%comment%}----------------------------------------------
Here **minus: 0** is a trick to convert day_index from string to integer and then use it as an array index.
----------------------------------------------{%endcomment%}
{% assign day_index = processed_date | date: "%w" | minus: 0 %}
{%comment%}-------- Output the date ----------{%endcomment%}
{{ month[month_index] }} {{ processed_date | date: "%Y" }}
{% endif %}