Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:ISOdate/doc: Difference between revisions

Template page
m Reverted edits by Melanieclopez0214 (talk) to last revision by Jarekt
Prefix language interwiki links with w:
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Lua|Module:ISOdate}}
{{TemplateBox
{{TemplateBox
|1=1
|1=1
|1aliases= date
|1aliases= date
|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.  
|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 hyphen-minus (-) and a 2-digit month number; optionally this is followed by hyphen-minus and a 2-digit day number; optionally this is followed by the time.  
|1label = date
|1label = date
|1d-td  = date
|1d-td  = date
Line 20: Line 21:
|5=case
|5=case
|5alias= form
|5alias= form
|5d-en=allows to specify [[:en:Grammatical case|grammatical case]] for the month for languages that use them. Possible cases:
|5d-en=allows to specify [[:w:Grammatical case|grammatical case]] for the month for languages that use them. Possible cases:
*leave blank for default case, which is usually [[:en:Nominative case|nominative]] or [[:en:Genitive case|genitive case]]
* leave blank for default case, which is usually [[:w:Nominative case|nominative]] in most languages or [[:w:Genitive case|genitive case]], for a date given in isolation (out of a sentence).
*"case=nom" for [[:en:Nominative case|nominative case]]
* "case=nom" for the [[:w:Nominative case|nominative case]] (for many languages with distinctive grammatical cases, for languages without case distinctions, this is the only existing form)
*"case=gen" for [[:en:Genitive case|genitive case]]
* "case=gen" for the [[:w:Genitive case|genitive case]] (supported for languages with distinctive grammatical cases)
*"case=loc" for [[:en:Locative case|locative case]] (supported for pl, cs & sl languages)
* "case=loc" for the [[:w:Locative case|locative case]] (supported for languages: pl, cs, sl)
*"case=ins" for [[:en:Instrumental case|instrumental case]] (supported for ru, pl, cs & sl languages)
* "case=ins" for the [[:w:Instrumental case|instrumental case]] (supported for languages: ru, pl, cs, sl)
Also [[:en:Partitive case|Partitive]] (ptv), [[:en:Inessive case|Inessive]] (ine), [[:en:Elative case|Elative]] (ela) and [[:en:Illative case|Illative]] (ill) cases are supported for Finnish language, in addition to [[:en:Nominative case|Nominative]] and [[:en:Genitive case|Genitive]] (gen).
* "case=ptv" for the [[:w:Partitive case|partitive case]] (supported for language: fi)
* "case=ine" for the [[:w:Inessive case|inessive case]] (supported for language: fi)
* "case=ela" for the [[:w:Elative case|elative case]] (supported for language: fi)
* "case=ill" for the [[:w:Illative case|illative case]] (supported for language: fi)
|5label = case
|5label = case
|5d-td  = case
|5d-td  = case
Line 32: Line 36:


|6=class
|6=class
|6d-en=allows to set the html class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by [[w:HCalendar|hCalendar]]). See [[Commons:Microformats Project|the microformats project]]. "class=" will remove all metadata.  
|6d-en=allows to set the html class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by [[w:HCalendar|hCalendar]]). See [[Commons:Microformats Project|the microformats project]]. "class=-" or "class=" will remove all metadata.  
|6label = class
|6label = class
|6d-td  = class
|6d-td  = class
Line 50: Line 54:


|name=ISOdate
|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.
|desc=For a [[:w: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>).
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>).
Line 61: Line 65:
|i18n-desc=
|i18n-desc=
|seealso={{tl|date}}, {{tl|other date}}, {{tl|ISOyear}}
|seealso={{tl|date}}, {{tl|other date}}, {{tl|ISOyear}}
|relieson = [[Module:Date]]  
|relieson = [[Module:DateI18n]]  
|setscats=
|setscats=
|lines=one
|lines=one
Line 72: Line 76:
|-
|-
|
|
:<code><nowiki>{{ISOdate|2010-11-01}}</nowiki></code>: {{ISOdate|2010-11-01}}
:<code><nowiki>{{ISOdate|2010-08-18 18:15:30Z}}</nowiki></code>: {{ISOdate|2010-08-18 18:15:30Z}}
:<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:30}}</nowiki></code>: {{ISOdate|2010-08-18 08:15:30}}

Latest revision as of 09:16, 12 August 2026

For a calendar date in ISO 8601 extended format in the form YYYY-MM-DD (e.g. "2026-08-21"), 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

ParameterDescriptionDefaultStatus
1
date
dateAny 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 hyphen-minus (-) and a 2-digit month number; optionally this is followed by hyphen-minus and a 2-digit day number; optionally this is followed by the time.emptyrequired
lang
2
languagelanguage 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 ({{int:Lang}})optional
casecaseallows to specify grammatical case for the month for languages that use them. Possible cases:
  • leave blank for default case, which is usually nominative in most languages or genitive case, for a date given in isolation (out of a sentence).
  • "case=nom" for the nominative case (for many languages with distinctive grammatical cases, for languages without case distinctions, this is the only existing form)
  • "case=gen" for the genitive case (supported for languages with distinctive grammatical cases)
  • "case=loc" for the locative case (supported for languages: pl, cs, sl)
  • "case=ins" for the instrumental case (supported for languages: ru, pl, cs, sl)
  • "case=ptv" for the partitive case (supported for language: fi)
  • "case=ine" for the inessive case (supported for language: fi)
  • "case=ela" for the elative case (supported for language: fi)
  • "case=ill" for the illative case (supported for language: fi)
emptyoptional
classclassallows to set the html class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by hCalendar). See the microformats project. "class=-" or "class=" will remove all metadata.dtstartoptional
trim_year
trim year
trim yearShould years smaller than 1000 be padded with zeros to the length of 4 digits or trimmed. Options:
  • 1, yes, true - for always trimming
  • 0, no, false - for always padding
  • xx-yy - where xx is a minimum trimmed year and yy is the maximum trimmed year, for conditional trimming which depends on the year range.
  • 100-999optional

    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:
    Module:DateI18n

    Example

    {{ISOdate|2026-08-21}}
    

    renders as:

    21 August 2026

    See also

    Localization

    This template is not intended to be localized.

    Test cases

    {{ISOdate|2010-11-01}}: 1 November 2010
    {{ISOdate|2010-08-18 18:15:30Z}}: 18 August 2010, 18:15:30
    {{ISOdate|2010-08-18 08:15:30}}: 18 August 2010, 08:15:30
    {{ISOdate|2010-08-18 08:15}}: 18 August 2010, 08:15
    {{ISOdate|2010-08-18}}: 18 August 2010
    {{ISOdate|2010-08}}: August 2010
    {{ISOdate|2010}}: 2010
    {{ISOdate|1970-08-18 08:15:30}}: 18 August 1970, 08:15:30
    {{ISOdate|1969-08-18 08:15:30}}: 18 August 1969, 08:15:30
    {{ISOdate|1800-08-18 08:15:30}}: 18 August 1800, 08:15:30
    {{ISOdate|999-08-18 08:15:30}}: 18 August 999 08:15:30
    {{ISOdate|119-08-18 08:15:30}}: 18 August 119 08:15:30
    {{ISOdate|99-08-18 08:15:30}}: 18 August 0099 08:15:30
    {{ISOdate|19-08-18 08:15:30}}: 18 August 0019 08:15:30
    {{ISOdate|9-08-18 08:15:30}}: 18 August 0009 08:15:30
    {{ISOdate|1-08-18 08:15:30}}: 18 August 0001 08:15:30
    {{ISOdate|1970-08-18}}: 18 August 1970
    {{ISOdate|1969-08-18}}: 18 August 1969
    {{ISOdate|1800-08-18}}: 18 August 1800
    {{ISOdate|999-08-18}}: 18 August 999
    {{ISOdate|119-08-18}}: 18 August 119
    {{ISOdate|99-08-18}}: 18 August 0099
    {{ISOdate|19-08-18}}: 18 August 0019
    {{ISOdate|9-08-18}}: 18 August 0009
    {{ISOdate|1-08-18}}: 18 August 0001
    {{ISOdate|1970-08}}: August 1970
    {{ISOdate|1969-08}}: August 1969
    {{ISOdate|1800-08}}: August 1800
    {{ISOdate|999-08}}: August 999
    {{ISOdate|119-08}}: August 119
    {{ISOdate|99-08}}: August 0099
    {{ISOdate|19-08}}: August 0019
    {{ISOdate|9-08}}: August 0009
    {{ISOdate|1-08}}: August 0001
    {{ISOdate|1970}}: 1970
    {{ISOdate|1969}}: 1969
    {{ISOdate|1800}}: 1800
    {{ISOdate|999}}: 999
    {{ISOdate|119}}: 119
    {{ISOdate|99}}: 0099
    {{ISOdate|19}}: 0019
    {{ISOdate|9}}: 0009
    {{ISOdate|1}}: 0001
    {{ISOdate|0}}: 0000
    {{ISOdate|1567-02-29}}: 1 March 1567
    {{ISOdate|2000-02-29}}: 29 February 2000


    Cookies help us deliver our services. By using our services, you agree to our use of cookies.