Template:Event date

From OpenStreetMap Wiki
Jump to navigation Jump to search

23 Nov2024-11-232024-11-24

[Edit] [Purge] Template-info.svg Template documentation

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}} → 23 Nov2024-11-232024-11-24
  • {{Event date|+1day}} → 24 Nov2024-11-242024-11-25
  • {{Event date|4 March 2019}} → 4 Mar2019-03-042019-03-05
  • {{Event date|March 4, 2019}} → 4 Mar2019-03-042019-03-05
  • {{Event date|2019-03-04}} → 4 Mar2019-03-042019-03-05
  • {{Event date|2019-03-04|2019-03-04}} → 4 Mar2019-03-042019-03-05
  • {{Event date|2019-03-04|2019-03-05}} → 4–5 Mar2019-03-042019-03-06
  • {{Event date|2019-03-04|2019-04-01}} → 4 Mar – 1 Apr2019-03-042019-04-02
  • {{Event date|2019-03-04|2020-01-01}} → 4 Mar 2019 – 1 Jan 20202019-03-042020-01-02
  • {{Event date|2019-03-04|2019-01-01}}Lua error in Module:Dates at line 36: Start date must precede end date.2019-03-042019-01-02
  • {{Event date|2019-03-04|2019-03-05|lang=es}} → 4–5 de mar2019-03-042019-03-06
  • {{Event date|2019-03-04|2019-04-01|lang=ja}} → 3月4日~4月1日2019-03-042019-04-02

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.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Start date1

The start date, or the current date if omitted

Example
2019-03-04
Datesuggested
End date2

The end date, or the start date if omitted

Dateoptional
Language codelang

The ISO 639 language code of the outputted date, or the page’s current language if omitted

Example
de
Stringoptional
Plain textraw

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

Booleanoptional