Changes

Jump to navigation Jump to search
{{Documentation subpage}}
{{template rating |alpha}}
{{lua|Module:{{PAGENAME}}}}

{{tl|{{PAGENAME}}}} aka {{tlg|Moveable date|bold=yes|nolink=yes}} is for displaying the [[calendar date]] of holidays or events that move annually, that do not have a fixed day and month of occurrence.

Examples include the Jewish new year [[Hanukkah]] which is based on a non-Gregorian calendar system. The [[June solstice]] wobbles celestially.

== Usage ==
The template requires only two arguments, the holiday/event name ({{para|holiday}} or {{para|event}} are synonymous) and the year {{para|year}}.

Example:
::<code><nowiki>{{calendar date |holiday=Rosh Hashanah |year=2019}}</nowiki></code>
::Produces: <br>
:::{{Calendar date |holiday=Rosh Hashanah |year=2019}}

Optionally try {{para|format|infobox}} in an infobox

Example:
::<code><nowiki>{{Calendar date |holiday=Rosh Hashanah |year=2019 |format=infobox}}</nowiki></code>
::Produces: <br>
:::{{Calendar date |holiday=Rosh Hashanah |year=2019 |format=infobox}}

== Options ==

'''Required'''

:;holiday or event: Name of an available holiday. Ex. {{para|holiday|Rosh Hashanah}} or {{para|event|Rosh Hashanah}}
:;year: Year of event. Ex. {{para|year|2019}}

'''Options'''

:;df: Date Format options can be "dmy", "mdy" or "iso" ({{para|df|dmy}}). Defaults are set in [[Module:Calendar date/Events]]
:;format: Use {{para|format|infobox}} in an infobox
:;cite: If set to anything ({{para|cite}}) a citation is added.

== Adding or editing holidays ==

Holidays are configured in [[Module:Calendar date/Events]] which has additional documentation and examples.

There are two holiday types: "calculator" and "localfile".

'''calculator''' - Moveable dates are determined with a calculator plugin. For example [[Rosh Hashanah]] uses the {{tlx|Hebrew year}} calculator:
::<code><nowiki>datatype = "calculator"</nowiki></code>
::<code><nowiki>datasource = "{{#time:Y-m-d|@{{Hebrew year/rhdatum|{{#timel:xjY|YYYY-11-1}}}}-1 days}}"</nowiki></code>

:When the template runs, it replaces "YYYY" with the value of the {{para|year}} argument, then executes the <code>datasource</code> code. Calculators can be any available on Wikipedia, so long as it accepts a year value and returns a date in ISO format. All calculators are third-party plugins, the template does not do calculations.

'''localfile''' - When a calculator is not possible or unavailable, moveable dates can be stored in local files. For example with [[Tu BiShvat]]:
::<code><nowiki>datatype = "localfile"</nowiki></code>
::<code><nowiki>datasource = "Module:Calendar date/localfiles/Tu BiShvat"</nowiki></code>

:The file [[Module:Calendar date/localfiles/Tu BiShvat]] contains a static list of dates.

'''wikidata''' - <to be developed - see talk page for more info>

==Holidays with multiple aliases==
If a holiday has multiple aliases, and it's desired the template support them with the {{para|holiday}} argument, create multiple entries in [[Module:Calendar date/Events]] one for each name.

==Dynamic dates==
The {{para|year}} can accept templates.

:For example, to show the current year for [[Tu BiShvat]] use {{tlx|CURRENTYEAR}}:
::<code><nowiki>{{Moveable date |holiday=Tu BiShvat |year={{CURRENTYEAR}}}}</nowiki></code>
:Produces
::{{Moveable date |holiday=Tu BiShvat |year={{CURRENTYEAR}}}}

Other useful templates are {{tlx|LASTYEAR}} and {{tlx|NEXTYEAR}}.

Combined they can be used in infoboxes to fully automate updates, example from the [[Hanukkah]] infobox:

:<code><nowiki>|date{{LASTYEAR}} = {{Moveable date |holiday=Hanukkah |year={{LASTYEAR}} |format=infobox |cite=}}</nowiki></code>
:<code><nowiki>|date{{CURRENTYEAR}} = {{Moveable date |holiday=Hanukkah |year={{CURRENTYEAR}} |format=infobox}}</nowiki></code>
:<code><nowiki>|date{{NEXTYEAR}} = {{Moveable date |holiday=Hanukkah |year={{NEXTYEAR}} |format=infobox}}</nowiki></code>
:<code><nowiki>|date{{NEXTYEAR|2}} = {{Moveable date |holiday=Hanukkah |year={{NEXTYEAR|2}} |format=infobox}}</nowiki></code>

== Tracking categories==

*[[:Category:Calendar date template errors]]

==VisualEditor TemplateData==
What is this? See https://www.mediawiki.org/wiki/Help:TemplateData

<templatedata>
{
"description": "A template for displaying moving calendar dates",
"params": {
"holiday": {
"label": "Name of holiday/event",
"description": "The name of the holiday or event",
"type": "string",
"example": "Rosh Hashana",
"required": true
},
"year": {
"label": "Holiday year",
"description": "The year to display the holiday dates for",
"type": "string",
"example": "2019",
"required": true
},
"format": {
"label": "Display format option",
"description": "Options for controlling display output such as for an infobox",
"type": "string",
"suggested": false,
"example": "infobox",
"default": "none"
},
"df": {
"label": "Date Format",
"description": "Date format to use when displaying dates",
"type": "string",
"suggested": false,
"example": "mdy",
"default": "dmy"
}
}
}
</templatedata>

==External links==
*[http://blog.ploeh.dk/2017/04/24/simple-holidays/ Simple holidays] by Mark Seemann

<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Templates that add a tracking category]]
[[Category:Time, date and calendar templates]]
}}</includeonly>
Anonymous user

Navigation menu