1- {% assign start_date = include.start | date: "%Y-%m-%d" %}{% assign end_date = include.end | date: "%Y-%m-%d" %}{% if start_date == end_date %}
2- {% comment %}When start and end dates are the same{% endcomment %}
3- {% assign day = start_date | date: "%-d" %}
4- {% assign year = start_date | date: "%Y" %}
5- {% capture month %}{% t "times.months.{{ start_date | date: "%B" }}" %}{% endcapture %}
6- {% capture pretty_date %}{{ day }}. {{ month }} {{ year }}{% endcapture %}
7- {% elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" %}
8- {% comment %}When start and end dates are in the same month{% endcomment %}
9- {% assign start_day = start_date | date: "%-d" %}
10- {% assign end_day = end_date | date: "%-d" %}
11- {% capture month %}{% t "times.months.{{ start_date | date: "%B" }}" %}{% endcapture %}
12- {% assign year = start_date | date: "%Y" %}
13- {% capture pretty_date %}{{ start_day }}. – {{ end_day }}. {{ month }} {{ year }}{% endcapture %}
14- {% elsif start_date | date: "%Y" == end_date | date: "%Y" %}
15- {% comment %}When start and end dates are in the same year{% endcomment %}
16- {% assign start_day = start_date | date: "%-d" %}
17- {% assign end_day = end_date | date: "%-d" %}
18- {% capture start_month %}{% t "times.months.{{ start_date | date: "%B" }}" %}{% endcapture %}
19- {% capture end_month %}{% t "times.months.{{ end_date | date: "%B" }}" %}{% endcapture %}
20- {% assign year = start_date | date: "%Y" %}
21- {% capture pretty_date %}{{ start_day }}. {{ start_month }} – {{ end_day }}. {{ end_month }} {{ year }}{% endcapture %}
22- {% else %}
23- {% comment %}When start and end dates are in different years{% endcomment %}
24- {% assign start_day = start_date | date: "%-d" %}
25- {% assign end_day = end_date | date: "%-d" %}
26- {% capture start_month %}{% t "times.months.{{ start_date | date: "%B" }}" %}{% endcapture %}
27- {% capture end_month %}{% t "times.months.{{ end_date | date: "%B" }}" %}{% endcapture %}
28- {% assign start_year = start_date | date: "%Y" %}
29- {% assign end_year = end_date | date: "%Y" %}
30- {% capture pretty_date %}{{start_day}}. {{ start_month}} {{ start_year }} – {{ end_day }}. {{ end_month }} {{ end_year }}{% endcapture %}
31- {% endif %}{{ pretty_date | strip }}
1+ {% assign start_date = include.start | date: "%Y-%m-%d" -%}
2+ {% assign end_date = include.end | date: "%Y-%m-%d" -%}
3+ {%- if start_date == end_date -%}
4+ {%- comment -%}When start and end dates are the same{%- endcomment -%}
5+ {% assign day = start_date | date: "%-d" -%}
6+ {% assign year = start_date | date: "%Y" -%}
7+ {%- capture month -%}
8+ {%- t "times.months.{{- start_date | date: "%B" -}}" -%}
9+ {%- endcapture -%}
10+ {%- capture pretty_date -%}
11+ {{- day -}}. {{- month -}} {{- year -}}
12+ {%- endcapture -%}
13+ {%- elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" -%}
14+ {%- comment -%}When start and end dates are in the same month{%- endcomment -%}
15+ {% assign start_day = start_date | date: "%-d" -%}
16+ {% assign end_day = end_date | date: "%-d" -%}
17+ {%- capture month -%}
18+ {%- t "times.months.{{- start_date | date: "%B" -}}" -%}
19+ {%- endcapture -%}
20+ {% assign year = start_date | date: "%Y" -%}
21+ {%- capture pretty_date -%}
22+ {{- start_day -}}. – {{- end_day -}}. {{- month -}} {{- year -}}
23+ {%- endcapture -%}
24+ {%- elsif start_date | date: "%Y" == end_date | date: "%Y" -%}
25+ {%- comment -%}When start and end dates are in the same year{%- endcomment -%}
26+ {% assign start_day = start_date | date: "%-d" -%}
27+ {% assign end_day = end_date | date: "%-d" -%}
28+ {%- capture start_month -%}
29+ {%- t "times.months.{{- start_date | date: "%B" -}}" -%}
30+ {%- endcapture -%}
31+ {%- capture end_month -%}
32+ {%- t "times.months.{{- end_date | date: "%B" -}}" -%}
33+ {%- endcapture -%}
34+ {% assign year = start_date | date: "%Y" -%}
35+ {%- capture pretty_date -%}
36+ {{- start_day -}}. {{- start_month -}} – {{- end_day -}}. {{- end_month -}} {{- year -}}
37+ {%- endcapture -%}
38+ {%- else -%}
39+ {%- comment -%}When start and end dates are in different years{%- endcomment -%}
40+ {% assign start_day = start_date | date: "%-d" -%}
41+ {% assign end_day = end_date | date: "%-d" -%}
42+ {%- capture start_month -%}
43+ {%- t "times.months.{{- start_date | date: "%B" -}}" -%}
44+ {%- endcapture -%}
45+ {%- capture end_month -%}
46+ {%- t "times.months.{{- end_date | date: "%B" -}}" -%}
47+ {%- endcapture -%}
48+ {% assign start_year = start_date | date: "%Y" -%}
49+ {% assign end_year = end_date | date: "%Y" -%}
50+ {%- capture pretty_date -%}
51+ {{-start_day-}}. {{- start_month-}} {{- start_year -}} – {{- end_day -}}. {{- end_month -}} {{- end_year -}}
52+ {%- endcapture -%}
53+ {%- endif -%}{{- pretty_date | strip -}}
0 commit comments