|
|
Line 81: |
Line 81: |
| ==Coding notes== | | ==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: <blockquote><tt><nowiki>{{#ifeq: {{#time:l|01 January {{{year|{{LOCALYEAR}}}}}}} | Tuesday |...}}</nowiki></tt></blockquote> In this example, the template is checking to see if the first day of January 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, <blockquote><tt><nowiki>{{#switch: {{#time:l|01 January {{{year|{{LOCALYEAR}}}}}}} | Tuesday | Wednesday =...</nowiki></tt></blockquote> however the logic is essentially the same. The usage of <tt>#ifeq</tt> is recommended to facilitate multiple overlapping events. | | *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: <blockquote><tt><nowiki>{{#ifeq: {{#time:l|01 January {{{year|{{LOCALYEAR}}}}}}} | Tuesday |...}}</nowiki></tt></blockquote> In this example, the template is checking to see if the first day of January 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, <blockquote><tt><nowiki>{{#switch: {{#time:l|01 January {{{year|{{LOCALYEAR}}}}}}} | Tuesday | Wednesday =...</nowiki></tt></blockquote> however the logic is essentially the same. The usage of <tt>#ifeq</tt> is recommended to facilitate multiple overlapping events. |
− | **For days with multiple events (i.e., those with multiple <tt>#switch</tt> and <tt>#ifeq</tt> functions), the following hierarchy is recommended. The arrangement of multiple events that occur on the same category (e.g., January's Yay Day and Flea Market, which are both ''events that fall on a non-specific day but on a specific week'') is up to the discretion of the editor; however, as much as possible, they should be arranged from earliest appearance (game) to latest, regionally (international, NA, JP, EU, KO), alphabetically. | + | **For days with multiple events (i.e., those with multiple <tt>#switch</tt> and <tt>#ifeq</tt> functions), the following hierarchy is recommended. The arrangement of multiple events that occur in the same category (e.g., January's Yay Day and Flea Market, which are both ''events that fall on a non-specific day but on a specific week'') is up to the discretion of the editor; however, as much as possible, they should be arranged from earliest appearance (game) to latest, regionally (international, NA, JP, EU, KO), alphabetically. |
| ***Events that fall on a specific day every year (e.g., [[Valentine's Day]] and [[Leap Day]]), excluding birthdays | | ***Events that fall on a specific day every year (e.g., [[Valentine's Day]] and [[Leap Day]]), excluding birthdays |
| ***Events that fall on a specific day on certain years (e.g., [[Festivale]]) | | ***Events that fall on a specific day on certain years (e.g., [[Festivale]]) |
Line 88: |
Line 88: |
| ***Birthdays, non-special to special. | | ***Birthdays, non-special to special. |
| **Those who look at the code may be surprised when they see <tt><nowiki><!--\n\t--></nowiki></tt>. The presence of this quirk is to make the code legible for future maintainers, and so that line breaks will not be recorded (e.g., if the <tt>#ifeq</tt> statement fails). The reason why <tt><nowiki>\n\t</nowiki></tt> is not used is because unwanted linebreaks will occur: see [https://www.mediawiki.org/wiki/Topic:Pqwack7wze5mkv2q this page] for more information. For those who will revise the code in the future, they may temporarily replace <tt><nowiki><!--\n\t--></nowiki></tt> with <tt><nowiki>\n\t</nowiki></tt> in a text editor, and do the reverse afterwards. | | **Those who look at the code may be surprised when they see <tt><nowiki><!--\n\t--></nowiki></tt>. The presence of this quirk is to make the code legible for future maintainers, and so that line breaks will not be recorded (e.g., if the <tt>#ifeq</tt> statement fails). The reason why <tt><nowiki>\n\t</nowiki></tt> is not used is because unwanted linebreaks will occur: see [https://www.mediawiki.org/wiki/Topic:Pqwack7wze5mkv2q this page] for more information. For those who will revise the code in the future, they may temporarily replace <tt><nowiki><!--\n\t--></nowiki></tt> with <tt><nowiki>\n\t</nowiki></tt> in a text editor, and do the reverse afterwards. |
− | **With regards to overlapping events, it is assumed that multiple events will occur in the same day. For example, in 1 April 2018, both [[Bunny Day]] and [[April Fool's Day]] occur at the same day in {{NL|short|nolink}}. Another example is 14 February 2026, when both the [[Fishing Tourney]] and [[Valentine's Day]] occur in {{CF|short|nolink}}. Unless otherwise stated, all events that overlap each other will occur at the same day.<br> | + | **With regards to overlapping events, it is assumed that multiple events will occur on the same day. For example, in 1 April 2018, both [[Bunny Day]] and [[April Fool's Day]] occur on the same day in {{NL|short|nolink}}. Another example is 14 February 2026, when both the [[Fishing Tourney]] and [[Valentine's Day]] occur in {{CF|short|nolink}}. Unless otherwise stated, all events that overlap each other will occur at the same day.<br> |
| *The calculation of certain holidays such as [[Festivale]] and [[Bunny Day]] are particularly difficult, for they depend on the lunisolar calendar. The implementation for these holidays is as follows: determine whether <tt><nowiki>{{{year|{{LOCALYEAR}}}}}</nowiki></tt> matches for some pre-determined date:<blockquote><tt><nowiki>|28 = {{#switch: {{{year|{{LOCALYEAR}}}}} | 2022 | 2033 = ...</nowiki></tt></blockquote>A list, for example, of all dates for Festivale must be known beforehand. This is much easier; however, it means that the template must be updated sometime in the future to show the correct dates for certain holidays in 2050 onward and for future releases. | | *The calculation of certain holidays such as [[Festivale]] and [[Bunny Day]] are particularly difficult, for they depend on the lunisolar calendar. The implementation for these holidays is as follows: determine whether <tt><nowiki>{{{year|{{LOCALYEAR}}}}}</nowiki></tt> matches for some pre-determined date:<blockquote><tt><nowiki>|28 = {{#switch: {{{year|{{LOCALYEAR}}}}} | 2022 | 2033 = ...</nowiki></tt></blockquote>A list, for example, of all dates for Festivale must be known beforehand. This is much easier; however, it means that the template must be updated sometime in the future to show the correct dates for certain holidays in 2050 onward and for future releases. |
| </noinclude> | | </noinclude> |