Template:Event date/doc
This is a documentation subpage for Template:Event date. It contains usage information, categories and other content or metadata that is not part of the original template. |
This template inserts the specified date or date range formatted for human readability.
This template is intended to be used in space-constrained contexts where the year is already obvious to the reader. Date ranges are displayed in a compact form suitable for use in tables. Years are omitted unless the date range spans a new year.
Usage
{{Event date|start|end|lang=xx}}
Parameters:
- |start =
- The start date, or the current date if omitted.
- |end =
- The end date, or the start date if omitted.
- |lang =
- (Optional) The ISO 639 language code of the outputted date, or the page's current language (as determined by {{Langcode}} if omitted.
- |raw =
- (Optional) If set, only the date text is outputted and microformats are omitted. Set this parameter if the output is used as input to another module or part of a page name.
|start = and |end = may be relative or absolute timestamps. If only the day and month are specified, the template assumes the current year as of the time the page is loaded – not necessarily the year that the template was used. So you might as well specify a full date including the year. Acceptable timestamp formats are described in the ParserFunctions extension's documentation.
If |end = is set to an earlier date than |start =, an error is thrown.
Examples
{{Event date}}
→ 21 Nov{{Event date|+1day}}
→ 22 Nov{{Event date|4 March 2019}}
→ 4 Mar{{Event date|March 4, 2019}}
→ 4 Mar{{Event date|2019-03-04}}
→ 4 Mar{{Event date|2019-03-04|2019-03-04}}
→ 4 Mar{{Event date|2019-03-04|2019-03-05}}
→ 4–5 Mar{{Event date|2019-03-04|2019-04-01}}
→ 4 Mar – 1 Apr{{Event date|2019-03-04|2020-01-01}}
→ 4 Mar 2019 – 1 Jan 2020{{Event date|2019-03-04|2019-01-01}}
→ Lua error in Module:Dates at line 36: Start date must precede end date.{{Event date|2019-03-04|2019-03-05|lang=es}}
→ 4–5 de mar{{Event date|2019-03-04|2019-04-01|lang=ja}}
→ 3月4日~4月1日
Microformats
Unless |raw = is set, this template also inserts invisible microformats for the date or date range (in standard ISO 8601 format YYYY-MM-DD), usable by external parsers (such as pin13.net/mf2 for parsing Template:Calendar and generate JSON data) for creating custom calendars.
No indication of time is given: as the default time is at start of the day (at 00:00 UTC), the second date given in date ranges will be converted in the generated microformat at start of the following day (at 00:00 UTC).
See also
Inserts the specified date or date range formatted for human readability.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Start date | 1 | The start date, or the current date if omitted
| Date | suggested |
End date | 2 | The end date, or the start date if omitted | Date | optional |
Language code | lang | The ISO 639 language code of the outputted date, or the page’s current language if omitted
| String | optional |
Plain text | raw | If set, only the date text is outputted and microformats are omitted; set this parameter if the output is used as input to another module or part of a page name | Boolean | optional |