<Loop type=calendar_year>
<time datetime="{Field year}" class="year">
<Set calendar_year><Field year /></Set>
<Loop type=calendar_month>
<Set calendar_month><Date format="m" from_format="n"><Field month /></Date></Set>
<time datetime="{Get calendar_year}-{Get calendar_month}" class="month">
<Field name /> <Get calendar_year />
<div class="week">
<Loop type=calendar_weekday>
<abbr title="{Field name}"><Field short_name /></abbr>
</Loop>
</div>
<Loop field=week>
<time datetime="{Get calendar_year}-W{Field week}" class="week">
<Loop field=day>
<If check="{Date format='Y-m-d'}" value="{Field date}">
<Set dateClassToday>today</Set>
<Else />
<Set dateClassToday></Set>
</If>
<If check="{Get calendar_month}" value="{Field date format=m}">
<Set dateClassMonth></Set>
<Else />
<Set dateClassMonth>not-this-month</Set>
</If>
<div class="calendar-day {Get dateClassToday} {Get dateClassMonth}">
<time datetime="{Field date}"><Field day /></time>
</div>
</Loop>
</time>
</Loop>
</time>
</Loop>
</time>
</Loop>
Example Output:
Some simple styling to get you started:
.week {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
text-align: center;
}
.week > * {
-ms-flex: 1 0 calc(100% / 7);
flex: 1 0 calc(100% / 7);
}
.month-label {
font-weight: bold;
text-align: center;
}
.today time {
background: blue;
color: #fff;
}
.not-this-month time {
color: #aaa;
}
.calendar-day {
padding: .5rem;
min-height: 5rem;
position: relative;
text-align: center;
}
.calendar-day time {
margin: 2px 0;
text-align: center;
display: inline-block;
vertical-align: middle;
width: 2rem;
height: 2rem;
line-height: 2rem;
border-radius: 2rem;
}
By Julia Canzani
Template
<Loop type=calendar_year>
<time datetime="{Field year}" class="year">
<Set calendar_year><Field year /></Set>
<Loop type=calendar_month>
<Set calendar_month><Date format="m" from_format="n"><Field month /></Date></Set>
<time datetime="{Get calendar_year}-{Get calendar_month}" class="month">
<Field name /> <Get calendar_year />
<div class="week">
<Loop type=calendar_weekday>
<abbr title="{Field name}"><Field short_name /></abbr>
</Loop>
</div>
<Loop field=week>
<time datetime="{Get calendar_year}-W{Field week}" class="week">
<Loop field=day>
<If check="{Date format='Y-m-d'}" value="{Field date}">
<Set dateClassToday>today</Set>
<Else />
<Set dateClassToday></Set>
</If>
<If check="{Get calendar_month}" value="{Field date format=m}">
<Set dateClassMonth></Set>
<Else />
<Set dateClassMonth>not-this-month</Set>
</If>
<div class="calendar-day {Get dateClassToday} {Get dateClassMonth}">
<time datetime="{Field date}"><Field day /></time>
</div>
</Loop>
</time>
</Loop>
</time>
</Loop>
</time>
</Loop>