Template:CalFillMarch

From Nookipedia, the Animal Crossing wiki
Revision as of 18:00, December 27, 2016 by Sunmarsh (talk | contribs) (Template completed, coding notes added)
← February March 2024 April →
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
25
26
27
Flea Market (WW)
28
Girl's Festival (CF)
29
1
2
3
4
5
La-Di-Day (WW)
6
Fishing Tourney (WW)
7
8
9
10
Girl's Festival (DnM)
11
12
Fishing Tourney (CF/NL)
13
Yay Day (WW)
14
15
Father's Day (CF/NL) Template:NA
16
Spring Sports Fair (AC)
17
Spring Sports Fair (AC)
18
19
20
Flea Market (CF)
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6

Usage

This template is used to automatically generate and populate a template call for Template:Calendar for the month of March for the year specified. If no year is provided, the current year will be used.

Coding notes

  • The template determines when a non-date specific event (e.g. fourth Thursday in November) occurs by using the following formula for each possible date that event could occur on:

    {{#ifeq: {{#time:l|01 February {{{year|{{LOCALYEAR}}}}}}} | Tuesday |...

    In this example, the template is checking to see if the first day of February was a Tuesday, and if so it will insert information about the event (represented by "..." in this example). If an event lasts for more than one day (e.g. Bright Nights) a #switch function is used instead,

    {{#switch: {{#time:l|01 February {{{year|{{LOCALYEAR}}}}}}} | Tuesday | Wednesday =...

    however the logic is essentially the same.


  • The calculation of Festivale's date is particularly difficult in that it varies based on Easter, which is determined by a lunisolar calendar. Rather than attempt to calculate Easter's date in a given year and from that value calculate Festivale's date (which is 48 days before Easter), I instead researched Festivale's date for the next 11 years and had the template check if {{{year|{{LOCALYEAR}}}}} matched for that date:

    |27 = {{#ifeq: {{{year|{{LOCALYEAR}}}}} | 2017 |...

    This is much easier, however it means that the template must be updated sometime in the future to show the correct dates for Festivale in 2028 onward.