Create A calendar in Tera

It’s been a few months, so I could be remembering incorrectly, but I don’t believe that I found this anywhere. I am remembering rewriting my old Hugo template in Tera to generate my colander for my weather history calendar.

{%- set Year = page.year -%}

 {% set First = Year~"-01-01" | date(format="%Y-%m-%d") %}
 {%- set Last = Year~"-12-31" | date(format="%Y-%m-%d") -%}
{% set FirstMonth = First | date(format="%m" ) | int %}
 {% set LastMonth = Last | date(format="%m" ) | int %}
{% set DaysPerMonth = config.extra.DaysPerMonth %}
{% set DaysOfWeek = config.extra.DaysOfWeek %}
 {%- set PreviousYear = Year - 1 -%}
 {%- set NextYear = Year + 1 -%}
{% set isLeapYear = ( Year % 4) %}
<article class="content">
<h1 id="top" class="title"> Mount Joy Personal Weather Station Data For {{ section.extra.date | date(format="%Y") }} </h1>{{ section.content | safe}}
{%- include "Wx/years.html" -%}
{%- include "Wx/months.html" -%}
{% for M in DaysPerMonth %}
<h2 class="month" id="{{- M.Name -}}"> {{- M.Name -}} </h2>
<ul class="days">
{%- if isLeapYear == 0 and M.Month == 2 -%}
{%- set TotalDays = 30 -%}
{%- else -%}
{%- set TotalDays = M.Days + 1 -%}
{%- set Date = Year~"-"~M.Month~"-"~"01" -%}
{%- set FirstWeekdayMondayOffset = Date | date(format="%w") | int -%}
{%- endif -%}
{%- for Day in DaysOfWeek -%}
<li class="weekdays">
{{ Day.Short }}
</li>
{% endfor %}
{% for D in range(start=0, end=FirstWeekdayMondayOffset) %}
<li class="calendar-day"></li>
{%- endfor -%}
{%- for D in range(start=1,end=TotalDays) -%}
 {{ D }}
{%- endfor -%} </ul> {%- include "partials/top.html" -%}
{%- endfor -%}

Please don’t hesitate to use this if it will help you, and modify it as you need to make it work for your requirements.