summaryrefslogblamecommitdiffstats
path: root/_includes/dayofweek.html
blob: 794f5cbeedd86815fff988ac57bbb36d1710e6f0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11




                                                     
                                                                  




                                                                 
                                                                     
          
                                                                    






                                                                                                                                                  
{% comment %}
	argv: datestring
	return: day in week (1: monday)
{% endcomment %}
{% assign dayinweek_datearr = argv[0] | split: " " %}
{% assign dayinweek_datearr = dayinweek_datearr[0] | split: "-" %}
{% assign dayinweek_magic = "032503514624" | split: "" %}
{% assign dayinweek_mesec = dayinweek_datearr[1] | plus: 0 %}
{% assign dayinweek_day = dayinweek_datearr[2] | plus: 0 %}
{% assign dayinweek_magicselector = dayinweek_mesec | minus: 1 %}
{% if dayinweek_mesec < 3 %}
	{% assign dayofweek_leto = dayinweek_datearr[0] | minus: 1 %}
{% else %}
	{% assign dayofweek_leto = dayinweek_datearr[0] | plus: 0 %}
{% endif %}
{% assign return = dayofweek_leto | divided_by: 4 | plus: dayofweek_leto | plus: dayinweek_day | plus: dayinweek_magic[dayinweek_magicselector] %}
{% assign dayofweek_leto_div = dayofweek_leto | divided_by: 100 %}
{% assign return = return | minus: dayofweek_leto_div %}
{% assign dayofweek_leto_div = dayofweek_leto | divided_by: 400 %}
{% assign return = return | plus: dayofweek_leto_div %}
{% assign return = return | modulo: 7 %}