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