Template:ISOdate/doc: Difference between revisions
More actions
add template categories |
No edit summary |
||
| Line 1: | Line 1: | ||
{{TemplateBox | {{TemplateBox | ||
|1=1 | |1=1 | ||
|1d=Any [[w:Proleptic Gregorian calendar|proleptic Gregorian calendar]] or [[w:Gregorian calendar|Gregorian calendar]] date between | |1d=Any [[w:Proleptic Gregorian calendar|proleptic Gregorian calendar]] or [[w:Gregorian calendar|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. | ||
|1stat=required | |1stat=required | ||
| Line 41: | Line 41: | ||
==Example of where the template provides convenience== | ==Example of where the template provides convenience== | ||
*[[Template:Creator]] passes on the date of birth and death to e.g. [[Template:Creator/de]] and then to [[Template:Creator/layout]]. This is done through only two parameters ''birthdate'' and ''deathdate''. The last-mentioned template calls this template ISODate to extract the | * [[Template:Creator]] passes on the date of birth and death to e.g. [[Template:Creator/de]] and then to [[Template:Creator/layout]]. This is done through only two parameters ''birthdate'' and ''deathdate''. The last-mentioned template calls this template ISODate to extract the 6 date components, and the time components, if any. | ||
== Test cases == | == Test cases == | ||
| Line 149: | Line 149: | ||
|} | |} | ||
<includeonly> | <includeonly> | ||
[[Category:Time, date and calendar templates|{{PAGENAME}}]] | [[Category:Time, date and calendar templates|{{PAGENAME}}]] | ||
[[Category:User interface language dependent templates|{{PAGENAME}}]] | [[Category:User interface language dependent templates|{{PAGENAME}}]] | ||
[[en:Template:ISOdate]] | |||
</includeonly> | </includeonly> | ||
Revision as of 14:57, 17 July 2012
For a calendar date in ISO 8601 extended format in the form YYYY-MM-DD (e.g. "2026-08-22"), 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= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
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 | |
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 | |
f | format ("Y" for year-only output ["{{ISOdate|2008-08-06|f=Y}}" will result in the output "6 August 2008"). Similar to {{ISOyear}}. | empty | optional | |
form | allows to specify grammatical case for the month, for languages that use them. Possible cases:
| 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
Example
{{ISOdate|2009-08-18}}
renders as:
18 August 2009
See also
Localization
This template is not intended to be localized.
Example of where the template provides convenience
- Template:Creator passes on the date of birth and death to e.g. Template:Creator/de and then to Template:Creator/layout. This is done through only two parameters birthdate and deathdate. The last-mentioned template calls this template ISODate to extract the 6 date components, and the time components, if any.
Test cases
|
|
|
|
|
|