Template:CalFillFebruary

From Nookipedia, the Animal Crossing wiki
Revision as of 18:00, December 27, 2016 by Sunmarsh (talk | contribs) (Fixed code to display Festivale date in 2016 and 2022)
← January February 2024 March →
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
28
29
30
Groundhog Day (AC/CF/NL)
31
Flea Market (WW)
1
2
Bright Nights (WW)
3
Bright Nights (WW)
4
Bright Nights (WW)
5
Bright Nights (WW)
6
Bright Nights (WW)
7
Fishing Tourney (CF/NL)
Bright Nights (WW)
8
Bright Nights (WW)
9
Festivale (CF/NL)
10
11
Valentine's Day (AC/CF/NL)
12
13
14
15
16
17
18
19
20
21
22
Flea Market (CF)
Fishing Tourney (WW)
23
24
25
26
Leap Day (CF/NL)
27
28
29
1
2

Usage

This template is used to automatically generate and populate a template call for Template:Calendar for the month of January 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.