Template:ISOdate/sandbox/doc

From OpenMedia
Jump to: navigation, search

For a calendar date in ISO 8601 extended format in the form YYYY-MM-DD (e.g. "2024-12-13"), with or without time, this template extracts the year, month, day and time, and calls {{date}} with the year, month and day found to display the date in localised format, with the time, if specified, appended. It provides the convenience of passing on a date (or even a date and a time) from one template to another as a single parameter, even though {{date}} eventually needs the date components separately.

This template overcomes some flaws of the automatic conversion by {{#time: }} for non-full dates (e.g. "77-09" for September 77 AD, which would throw an error with {{#time: }}).

Usage

{{ISOdate|1=}}

Parameters

Parameter name Description Default value required or optional?

parameter #1 (1) Any proleptic Gregorian calendar or Gregorian calendar date between 1 January 1 AD and 31 December 9999 AD. Dates BC are not yet supported. Also incomplete dates are allowed: just the year or the year and the month. A year has to be written in full, without leading zeros. Optionally it is followed by a dash and a 2-digit month number; optionally this is followed by a dash and a 2-digit day number; optionally this is followed by the time. empty required
parameter #2 (2) language code (only needs to be provided if the language shall be fixed and independent from the user's preferences) language code of the user language optional
form allows to specify grammatical case for the month, for languages that use them. Possible cases: empty optional
debug Setting "debug=1" helps with debugging empty optional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:
{{date}}, {{ISOdate/time2}}, {{ISOdate/time3}},

Example

{{ISOdate|2009-08-18}}

renders as:

See also

{{date}}, {{other date}}, {{ISOyear}}

Localization

This template is not intended to be localized.


Test cases

{{ISOdate/sandbox|2010-08-18 18:15:30Z}}: 2010-08-18 18:15:30Z
{{ISOdate/sandbox|2010-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|2010-08-18 08:15}}: , 08:15
{{ISOdate/sandbox|2010-08-18}}:
{{ISOdate/sandbox|2010-08}}:
{{ISOdate/sandbox|2010}}:
{{ISOdate/sandbox|1970-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|1969-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|1800-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|999-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|119-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|99-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|19-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|9-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|1-08-18 08:15:30}}: , 08:15:30
{{ISOdate/sandbox|1970-08-18}}:
{{ISOdate/sandbox|1969-08-18}}:
{{ISOdate/sandbox|1800-08-18}}:
{{ISOdate/sandbox|999-08-18}}:
{{ISOdate/sandbox|119-08-18}}:
{{ISOdate/sandbox|99-08-18}}:
{{ISOdate/sandbox|19-08-18}}:
{{ISOdate/sandbox|9-08-18}}:
{{ISOdate/sandbox|1-08-18}}:
{{ISOdate/sandbox|1970-08}}:
{{ISOdate/sandbox|1969-08}}:
{{ISOdate/sandbox|1800-08}}:
{{ISOdate/sandbox|999-08}}:
{{ISOdate/sandbox|119-08}}:
{{ISOdate/sandbox|99-08}}:
{{ISOdate/sandbox|19-08}}:
{{ISOdate/sandbox|9-08}}:
{{ISOdate/sandbox|1-08}}:
{{ISOdate/sandbox|1970}}:
{{ISOdate/sandbox|1969}}:
{{ISOdate/sandbox|1800}}:
{{ISOdate/sandbox|999}}:
{{ISOdate/sandbox|119}}:
{{ISOdate/sandbox|99}}:
{{ISOdate/sandbox|19}}:
{{ISOdate/sandbox|9}}:
{{ISOdate/sandbox|1}}:
{{ISOdate/sandbox|0}}:
{{ISOdate/sandbox|1567-02-29}}: 1567-02-29
{{ISOdate/sandbox|2000-02-29}}: