Template:ISOdate/doc: Difference between revisions
More actions
←Replaced page with 'Unsubscribe' |
m Reverted edits by 154.20.64.4 (talk) to last revision by Jarekt |
||
| Line 1: | Line 1: | ||
{{TemplateBox | |||
|1=1 | |||
|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 | |||
|2=2 | |||
|2d=language code (only needs to be provided if the language shall be fixed and independent from the user's preferences) | |||
|2def=language code of the user language | |||
|2stat=optional- | |||
|3=form | |||
|3d=allows to specify [[:en:Grammatical case|grammatical case]] for the month, for languages that use them. Possible cases: | |||
*"form=gen" for [[:en:Genitive case|genitive case]] | |||
*"form=loc" for [[:en:Locative case|locative case]] (supported for Polish (pl) and Czech (cs) languages) | |||
*"form=ins" for [[:en:Instrumental case|instrumental case]] (supported for Polish (pl) and Czech (cs) languages) | |||
*leave blank for [[:en:Nominative case|nominative case]] | |||
|3def= | |||
|3stat=optional- | |||
|4=debug | |||
|4d=Setting "debug=1" helps with debugging | |||
|4def= | |||
|4stat=optional- | |||
|name=ISOdate | |||
|desc=For a [[:en:ISO 8601#Calendar dates|calendar date in ISO 8601]] ''extended format'' in the form YYYY-MM-DD (e.g. "{{#time: Y-m-d }}"), with or without time, this template extracts the year, month, day and time, and calls {{tl|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 {{tl|date}} eventually needs the date components separately. | |||
This template overcomes some flaws of the automatic conversion by <nowiki>{{#time: }}</nowiki> for non-full dates (e.g. "77-09" for September 77 AD, which would throw an error with <nowiki>{{#time: }}</nowiki>). | |||
|namespace=all | |||
|usergroup=all | |||
|usage-notes= | |||
|type= | |||
|example=2009-08-18 | |||
|i18n-method=- | |||
|i18n-desc= | |||
|seealso={{tl|date}}, {{tl|other date}}, {{tl|ISOyear}} | |||
|relieson = {{tl|date}}, {{tl|ISOdate/time2}}, {{tl|ISOdate/time3}}, | |||
|setscats= | |||
|lines=one | |||
|shorthand= | |||
}} | |||
== Test cases == | |||
{| | |||
|- | |||
| | |||
:<code><nowiki>{{ISOdate|2010-08-18 18:15:30Z}}</nowiki></code>: {{ISOdate|2010-08-18 18:15:30Z}} | |||
:<code><nowiki>{{ISOdate|2010-08-18 08:15:30}}</nowiki></code>: {{ISOdate|2010-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|2010-08-18 08:15}}</nowiki></code>: {{ISOdate|2010-08-18 08:15}} | |||
:<code><nowiki>{{ISOdate|2010-08-18}}</nowiki></code>: {{ISOdate|2010-08-18}} | |||
:<code><nowiki>{{ISOdate|2010-08}}</nowiki></code>: {{ISOdate|2010-08}} | |||
:<code><nowiki>{{ISOdate|2010}}</nowiki></code>: {{ISOdate|2010}} | |||
:<code><nowiki>{{ISOdate|1970-08-18 08:15:30}}</nowiki></code>: {{ISOdate|1970-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|1969-08-18 08:15:30}}</nowiki></code>: {{ISOdate|1969-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|1800-08-18 08:15:30}}</nowiki></code>: {{ISOdate|1800-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|999-08-18 08:15:30}}</nowiki></code>: {{ISOdate|999-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|119-08-18 08:15:30}}</nowiki></code>: {{ISOdate|119-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|99-08-18 08:15:30}}</nowiki></code>: {{ISOdate|99-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|19-08-18 08:15:30}}</nowiki></code>: {{ISOdate|19-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|9-08-18 08:15:30}}</nowiki></code>: {{ISOdate|9-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|1-08-18 08:15:30}}</nowiki></code>: {{ISOdate|1-08-18 08:15:30}} | |||
:<code><nowiki>{{ISOdate|1970-08-18}}</nowiki></code>: {{ISOdate|1970-08-18}} | |||
:<code><nowiki>{{ISOdate|1969-08-18}}</nowiki></code>: {{ISOdate|1969-08-18}} | |||
:<code><nowiki>{{ISOdate|1800-08-18}}</nowiki></code>: {{ISOdate|1800-08-18}} | |||
:<code><nowiki>{{ISOdate|999-08-18}}</nowiki></code>: {{ISOdate|999-08-18}} | |||
:<code><nowiki>{{ISOdate|119-08-18}}</nowiki></code>: {{ISOdate|119-08-18}} | |||
:<code><nowiki>{{ISOdate|99-08-18}}</nowiki></code>: {{ISOdate|99-08-18}} | |||
:<code><nowiki>{{ISOdate|19-08-18}}</nowiki></code>: {{ISOdate|19-08-18}} | |||
| | |||
:<code><nowiki>{{ISOdate|9-08-18}}</nowiki></code>: {{ISOdate|9-08-18}} | |||
:<code><nowiki>{{ISOdate|1-08-18}}</nowiki></code>: {{ISOdate|1-08-18}} | |||
:<code><nowiki>{{ISOdate|1970-08}}</nowiki></code>: {{ISOdate|1970-08}} | |||
:<code><nowiki>{{ISOdate|1969-08}}</nowiki></code>: {{ISOdate|1969-08}} | |||
:<code><nowiki>{{ISOdate|1800-08}}</nowiki></code>: {{ISOdate|1800-08}} | |||
:<code><nowiki>{{ISOdate|999-08}}</nowiki></code>: {{ISOdate|999-08}} | |||
:<code><nowiki>{{ISOdate|119-08}}</nowiki></code>: {{ISOdate|119-08}} | |||
:<code><nowiki>{{ISOdate|99-08}}</nowiki></code>: {{ISOdate|99-08}} | |||
:<code><nowiki>{{ISOdate|19-08}}</nowiki></code>: {{ISOdate|19-08}} | |||
:<code><nowiki>{{ISOdate|9-08}}</nowiki></code>: {{ISOdate|9-08}} | |||
:<code><nowiki>{{ISOdate|1-08}}</nowiki></code>: {{ISOdate|1-08}} | |||
:<code><nowiki>{{ISOdate|1970}}</nowiki></code>: {{ISOdate|1970}} | |||
:<code><nowiki>{{ISOdate|1969}}</nowiki></code>: {{ISOdate|1969}} | |||
:<code><nowiki>{{ISOdate|1800}}</nowiki></code>: {{ISOdate|1800}} | |||
:<code><nowiki>{{ISOdate|999}}</nowiki></code>: {{ISOdate|999}} | |||
:<code><nowiki>{{ISOdate|119}}</nowiki></code>: {{ISOdate|119}} | |||
:<code><nowiki>{{ISOdate|99}}</nowiki></code>: {{ISOdate|99}} | |||
:<code><nowiki>{{ISOdate|19}}</nowiki></code>: {{ISOdate|19}} | |||
:<code><nowiki>{{ISOdate|9}}</nowiki></code>: {{ISOdate|9}} | |||
:<code><nowiki>{{ISOdate|1}}</nowiki></code>: {{ISOdate|1}} | |||
:<code><nowiki>{{ISOdate|0}}</nowiki></code>: {{ISOdate|0}} | |||
:<code><nowiki>{{ISOdate|1567-02-29}}</nowiki></code>: {{ISOdate|1567-02-29}} | |||
:<code><nowiki>{{ISOdate|2000-02-29}}</nowiki></code>: {{ISOdate|2000-02-29}} | |||
|} | |||
<includeonly> | |||
[[Category:Time, date and calendar templates|{{PAGENAME}}]] | |||
[[Category:User interface language dependent templates|{{PAGENAME}}]] | |||
[[en:Template:ISOdate]] | |||
</includeonly> | |||
Revision as of 08:29, 25 November 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 | |
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:
18 August 2009
See also
Localization
This template is not intended to be localized.
Test cases
|
|