Template:SpecDate

From NationStates Sports Wiki
(Redirected from Template:SpecDay)
Jump to navigation Jump to search

Usage

This template is designed to be a meta-template allowing users to specify the dates of events in their own calendar.

SpecDate should never be used directly, and should only be called as a sub-template.
e.g. {{SpecDate/OSR|WCQ98}}, which returns the values specified in the template as the Osarian calendar date corresponding to the start of World Cup 98 qualifying.

Additional templates and exist to allow this date to be output in different formats.
They should also be used as sub-templates, e.g. {{SpecDate dev/OSR|WCQ98}}, which returns 2330-09-05; and {{SpecDate short/OSR|WCQ98}} which returns 05/09/2330.

While one template could be used to determine all different calendar options, it would get unwieldy very quickly, and it would be easy for someone to accidentally break someone else's SpecDate functionality.

By keeping each nation's calendar events separate, it is much easier to troubleshoot and maintain this system.

Available DateSets

Setup

To set the correct values for events you will need to decide on three things:

  • DateSetCode: a trigramme or abbreviation for the date set (in the example, this is "OSR", the trigramme for Osarius)
  • EventCode: a code to represent the event the dates refer to (in the example this is "WCQ98", to represent the World Cup Qualifiers for edition 98)
  • EventDate: the date the event took place (or started, if it is across multiple days)

Main Template

Create SpecDate/DateSetCode and copy the following:

{{SpecDay/DateSetCode|{{{1}}}}} {{#switch: {{SpecMth/DateSetCode|{{{1}}}}} |  1 = January |  2 = February |  3 = March |  4 = April |  5 = May |  6 = June |  7 = July |  8 = August |  9 = September | 10 = October | 11 = November | 12 = December | January }}, {{SpecYr/DateSetCode|{{{1}}}}}<noinclude>

Make sure to replace "DateSetCode" with your chosen value.

The "<noinclude>" at the end means you can add notes and/or documentation after this if you like, and they won't be included when you use the template.
As a recommendation, this should probably contain a list or table of EventCodes available for this DateSet. See Template:SpecDate/OSR for an example.

Alternate Formats

Create SpecDate short/DateSetCode and copy the following:

{{#ifexpr: {{SpecDay/DateSetCode|{{{1}}}}}<10 | 0{{SpecDay/DateSetCode|{{{1}}}}} | {{SpecDay/DateSetCode|{{{1}}}}} }}/{{#ifexpr: {{SpecMth/DateSetCode|{{{1}}}}}<10 | 0{{SpecMth/DateSetCode|{{{1}}}}} | {{SpecMth/DateSetCode|{{{1}}}}} }}/{{SpecYr/OSR|{{{1}}}}}

Make sure to replace "DateSetCode" with your chosen value.

Create SpecDate dev/DateSetCode and copy the following:

{{SpecYr/DateSetCode|{{{1}}}}}-{{#ifexpr: {{SpecMth/DateSetCode|{{{1}}}}}<10 | 0{{SpecMth/DateSetCode|{{{1}}}}} | {{SpecMth/DateSetCode|{{{1}}}}} }}-{{#ifexpr: {{SpecDay/DateSetCode|{{{1}}}}}<10 | 0{{SpecDay/DateSetCode|{{{1}}}}} | {{SpecDay/DateSetCode|{{{1}}}}} }}

Make sure to replace "DateSetCode" with your chosen value.

Date Components

After this, you will then need to update the relevant subpages of SpecDay, SpecMth, and SpecYr (each followed by /DateSetCode, so SpecDay/OSR, etc)

On those pages, copy the following:

{{#switch: {{{1}}} | EventCode1 = 1 | EventCode2 = 1 | 1 }}

And replace "EventCode1", "EventCode2" etc with the codes you are using for the various events.
The numbers then represent the Day, Month, or Year of the date the event started or took place.

If you only have one EventCode, you can delete EventCode2. The final value is a default value to use when no EventCode is supplied.
It is recommended to set SpecDay and SpecMth to 1, and SpecYr to a significant year that will stand out as an obvious default (like 1900 in RL)

For example, if you wanted to add the World Cup 100 finals as starting on June 10th, 2326 in the calendar of Examplestan (XYZ):

  • Create the Template subpage SpecDate/XYZ if it doesn't already exist
  • Create SpecDate dev/XYZ and SpecDate short/XYZ as well if they don't already exist
  • Decide on an EventCode for the World Cup 100 finals (like WCF100)
  • Convert the EventDate into three numeric values (10 for day, 6 for month, 2326 for year)
  • Update each of SpecDay/XYZ, SpecMth/XYZ, and SpecYr/XYZ with the correct numeric EventDate value (e.g. SpecDay/XYZ should have 'WCF100 = 10' as an option in the switch statement)