Difference between revisions of "Template:Death date and age/doc"

From blackwiki
Jump to navigation Jump to search
imported>Fredde 99
(iw:sv)
imported>Jay D. Easy
(updated header template order)
 
(29 intermediate revisions by 23 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<includeonly>{{high-use|80,000+}}</includeonly>
+
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
{{High-use| 233,800 }}
 +
{{Warning |''Do '''NOT''' use this template when the person's exact date of death is disputed or unknown; consider {{tl|death year and age}} instead.''}}
 +
{{Template shortcut|dda}}
 +
{{Lua|Module:Age}}
  
Returns a person's date of death and age at that date.
+
This template returns a person's date of death and age at that date. The year, month, and day of death are required, as is the birth year. The month and day of birth are optional.
Available shortcut: '''{{tl|Dda}}'''.
 
  
<big style="color:#CC0000;">Do NOT use this template when the person's exact date of birth or death is disputed or unknown.  Consider {{Tl|Death year and age}} instead.</big>
+
===Syntax===
  
The idea of using the template, like with {{tl|Birth date and age}} etc, is to allow for the inclusion of hidden [[metadata]] to be used, indexed or searched by software tools. However, as of October 2008 this template does not include any such metadata and never has since it was founded in December 2006. The apparent reason is that the [[hCard]] [[microformat]], logically enough for an extension of "standard for electronic business cards", contains only "BDAY" field but nothing to do with a death. It is unclear when metadata standard for the dead will be developed and adopted. Until then, the template does nothing but format the input parameters.
+
====To display the death date with age====
 +
: {{tlc|death date and age<br />|''year of death''|''month of death''|''day of death''<br />|''year of birth''|''month of birth''|''day of birth''<br />|''additional parameters''}}
  
=== Syntax ===
+
; Formats:
==== To display the death date with age ====
+
: <code><nowiki>{{</nowiki>death date and age |yyyy|mm|dd |yyyy|mm|dd |df=yes}}</code>
: <code><nowiki>{{Death date and age|</nowiki></code>''year of death''<tt>|</tt>''month of death''<tt>|</tt>''day of death''<tt>|</tt>''year of birth''<tt>|</tt>''month of birth''<tt>|</tt>''day of birth''<tt>|''additional parameters''}}</tt>
+
: <code><nowiki>{{</nowiki>death date and age |yyyy|mm|dd |yyyy|mm|dd |mf=yes}}</code>
  
; Format:
+
====Examples when all parameters are known====
: <code><nowiki>{{Death date and age|yyyy|mm|dd|yyyy|mm|dd|df=yes}}</nowiki></code>
+
: <code><nowiki>{{death date and age |1993|2|24 |1921|4|12 |df=yes}}</nowiki></code> returns:&nbsp; {{death date and age |1993|2|24 |1921|4|12 |df=yes}}
: <code><nowiki>{{Death date and age|yyyy|mm|dd|yyyy|mm|dd|mf=yes}}</nowiki></code>
+
: <code><nowiki>{{death date and age |1993|2|24 |1921|4|12 |mf=yes}}</nowiki></code> returns:&nbsp; {{death date and age |1993|2|24 |1921|4|12 |mf=yes}}
  
==== Using the Dda shortcut ====
+
====Examples when only death-related parameters are known====
: <code><nowiki>{{Dda|yyyy|mm|dd|yyyy|mm|dd|df=yes}}</nowiki></code>
+
: <code><nowiki>{{death date and age |1993|2|24 |1921|4 |df=yes}}</nowiki></code> returns:&nbsp; {{death date and age |1993|2|24 |1921|4 |df=yes}}
: <code><nowiki>{{Dda|yyyy|mm|dd|yyyy|mm|dd|mf=yes}}</nowiki></code>
+
: <code><nowiki>{{death date and age |1993|2|24 |1921 |mf=yes}}</nowiki></code> returns:&nbsp; {{death date and age |1993|2|24 |1921 |mf=yes}}
  
==== Examples ====
+
When the exact birth date is unknown, the template will calculate the age at death and provide a range of two possible ages, if necessary.
: <code><nowiki>{{Death date and age|1993|2|24|1941|4|12|df=yes}}</nowiki></code> <br> returns {{Death date and age|1993|2|24|1941|4|12|df=yes}}
 
: <code><nowiki>{{Death date and age|1993|2|24|1941|4|12|mf=yes}}</nowiki></code> <br> returns {{Death date and age|1993|2|24|1941|4|12|mf=yes}}
 
  
'''Note''': The template will appear broken when the parameters are left blank.
+
''The template will generate an error when required parameters are left blank, or when parameters are invalid. Examples of invalid parameters include impossible human ages, months greater than 12 or less than 1, days greater than 31 or less than 1, and parameters in the wrong order.''
  
=== Day First (df) and Month First options ===
+
==="day first" (df) and "month first" options===
 
The '''df''' (day first) parameter indicates the intended date format to display. It is switched on by setting it to "y" or "yes" e.g. '''df=yes''' or '''df=y'''.
 
The '''df''' (day first) parameter indicates the intended date format to display. It is switched on by setting it to "y" or "yes" e.g. '''df=yes''' or '''df=y'''.
  
Line 36: Line 37:
  
 
Examples:
 
Examples:
 +
: <code><nowiki>{{death date and age |1993|2|24 |1921|4|12 |df=yes}}</nowiki></code> displays&nbsp; "{{death date and age |1993|2|24 |1921|4|12 |df=yes}}"
 +
: <code><nowiki>{{death date and age |1993|2|24 |1921|4|12 |mf=yes}}</nowiki></code> displays&nbsp; "{{death date and age |1993|2|24 |1921|4|12 |mf=yes}}"
  
:<nowiki>{{Death date and age|1993|2|24|1941|4|12|df=yes}}</nowiki><br> displays "{{Death date and age|1993|2|24|1941|4|12|df=yes}}"
+
===Alternate template when specific birth date is unknown===
:<nowiki>{{Death date and age|1993|2|24|1941|4|12|mf=yes}}</nowiki><br> displays "{{Death date and age|1993|2|24|1941|4|12|mf=yes}}"
+
When only the year of a person's death is known, or if it is desired not to state a person's full dates of birth and death (e.g. for privacy), use the template {{tl|death year and age}} instead. See below for other templates that perform similar functions.
  
=== Specific date unknown - alternate templates ===
+
===FAQ===
When only the year of a person's birth and/or death are known, or if it is desired not to state a person's full dates of birth and death for privacy reasons, use the templates {{tl|Birth year and age}} and {{tl|Death year and age}} instead.
+
* Q: Why don't these templates add categories such as "Births in [Year]" to articles where they are used?
 +
: A: Because they are sometimes used for dates in lists of people (e.g. members of sports teams).
  
=== Interaction side-effects with other templates ===
+
===Background===
'''Note:''' Do not use this template inside of the [[WP:PERSONDATA|Persondata]] template as it can interfere with data extraction.
+
The idea of using the template, as with {{tl|birth date and age}} etc., is to allow for the inclusion of hidden [[metadata]] to be used, indexed or searched by software tools. However, as of October 2008 this template does not include any such metadata and never has since it was founded in December 2006. The apparent reason is that the [[hCard]] [[microformat]], logically enough for an extension of "standard for electronic business cards", contains only "BDAY" field but nothing to do with a death. It is unclear when metadata standard for the dead will be developed and adopted. Until then, the template does nothing but format the input parameters.
  
=== FAQ ===
+
Because the hCard specification requires the use of the Gregorian calendar, the template should not be used for dates stated in the Julian calendar.
Q: Why don't these templates add categories, such as "Births in [Year]" to articles on which they are used? <br>
 
A: Because they are sometimes used for dates in lists of people, such as sports team members.
 
  
=== See also ===
+
===TemplateData===
*[[Wikipedia:Age calculation templates]]
+
{{TemplateData header}}
* {{tl|BirthDeathAge}} – carries out the functions of this template and all the following ones
+
<TemplateData>
* {{tl|Birth date}}
+
{
* {{tl|Birth date and age}} – same as {{tl|Birth date}}, except that "(age ##)" appears after the death date
+
        "description": "This template returns a person's date of death and age at that date.",
* {{tl|Birth year and age}} – year of birth and approximate age
+
        "params": {
* {{tl|Death date}}
+
                "1": {
* {{tl|Death year and age}} – year of death and approximate age at death
+
                        "label": "Year of death",
 +
                        "description": "The year in which the person died",
 +
                        "type": "number",
 +
                        "required": true
 +
                },
 +
                "2": {
 +
                        "label": "Month of death",
 +
                        "description": "The month (number) in which the person died",
 +
                        "type": "number",
 +
                        "required": true
 +
                },
 +
                "3": {
 +
                        "label": "Day of death",
 +
                        "description": "The day (number) in which the person died",
 +
                        "type": "number",
 +
                        "required": true
 +
                },
 +
                "4": {
 +
                        "label": "Year of birth",
 +
                        "description": "The year in which the person was born",
 +
                        "type": "number",
 +
                        "required": true
 +
                },
 +
                "5": {
 +
                        "label": "Month of birth",
 +
                        "description": "The month (number) in which the person was born",
 +
                        "type": "number",
 +
                        "required": false
 +
                },
 +
                "6": {
 +
                        "label": "Day of birth",
 +
                        "description": "The day (number) in which the person was born",
 +
                        "type": "number",
 +
                        "required": false
 +
                },
 +
                "df": {
 +
                        "label": "Day first",
 +
                        "description": "When set to 'y' or 'yes', the date of death is output in a DMY format",
 +
                        "type": "string",
 +
                        "required": false
 +
                },
 +
                "mf": {
 +
                        "label": "Month first",
 +
                        "description": "When set to 'y' or 'yes', stresses that the default MDY date format is intended for the date of death",
 +
                        "type": "string",
 +
                        "required": false
 +
                }
 +
        }
 +
}
 +
</TemplateData>
  
<includeonly>
+
{{Birth, death and age templates}}
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
+
 
[[Category:Date mathematics templates|Death date and age]]
+
<includeonly>{{Sandbox other|
[[Category:Templates generating microformat date and age|{{BASEPAGENAME}}]]
+
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
 +
[[Category:Date mathematics templates]]
 +
[[Category:Templates generating microformat date and age]]
  
[[ar:قالب:الوفاة والسن]]
 
[[bg:Шаблон:Дата на смърт и години]]
 
 
[[ca:Plantilla:Data naixement i edat]]
 
[[ca:Plantilla:Data naixement i edat]]
[[da:Skabelon:Dødsdato og alder]]
+
}}</includeonly>
[[eo:Ŝablono:Mortotago kaj aĝo]]
 
[[fa:الگو:تاریخ مرگ و سن]]
 
[[fr:Modèle:Date de décès]]
 
[[ko:틀:사망일과 만나이]]
 
[[hsb:Předłoha:Smjertny datum a staroba]]
 
[[hy:Կաղապար:Մահվան ամսաթիվ և տարիք]]
 
[[mk:Шаблон:Починал на и возраст]]
 
[[ja:Template:死亡年月日と没年齢]]
 
[[no:Mal:Dødsdato og alder]]
 
[[ro:Format:Death date and age]]
 
[[sk:Šablóna:Dátum úmrtia a vek]]
 
[[sv:Mall:Död datum och ålder]]
 
[[tl:Template:Death date and age]]
 
[[uk:Шаблон:Дата смерті з віком]]
 
[[vi:Tiêu bản:Ngày mất và tuổi]]
 
[[zh:Template:Death date and age]]
 
</includeonly>
 

Latest revision as of 21:54, 12 November 2020

This template returns a person's date of death and age at that date. The year, month, and day of death are required, as is the birth year. The month and day of birth are optional.

Syntax

To display the death date with age

{{death date and age
|year of death|month of death|day of death
|year of birth|month of birth|day of birth
|additional parameters}}
Formats
{{death date and age |yyyy|mm|dd |yyyy|mm|dd |df=yes}}
{{death date and age |yyyy|mm|dd |yyyy|mm|dd |mf=yes}}

Examples when all parameters are known

{{death date and age |1993|2|24 |1921|4|12 |df=yes}} returns:  24 February 1993(1993-02-24) (aged 71)
{{death date and age |1993|2|24 |1921|4|12 |mf=yes}} returns:  February 24, 1993(1993-02-24) (aged 71)

Examples when only death-related parameters are known

{{death date and age |1993|2|24 |1921|4 |df=yes}} returns:  24 February 1993(1993-02-24) (aged 71)
{{death date and age |1993|2|24 |1921 |mf=yes}} returns:  February 24, 1993(1993-02-24) (aged 71–72)

When the exact birth date is unknown, the template will calculate the age at death and provide a range of two possible ages, if necessary.

The template will generate an error when required parameters are left blank, or when parameters are invalid. Examples of invalid parameters include impossible human ages, months greater than 12 or less than 1, days greater than 31 or less than 1, and parameters in the wrong order.

"day first" (df) and "month first" options

The df (day first) parameter indicates the intended date format to display. It is switched on by setting it to "y" or "yes" e.g. df=yes or df=y.

The default output of this template is the month before the day (American-based style). This default may not be appropriate in articles about people from parts of the world where the day precedes the month in a date (e.g. Europe). In such cases the parameter df should be set.

It is possible to use similar parameter "mf" to stress the month-first format so that relying on the default does not lead an editor or bot to change the format to an unintended value; however, it is ignored by the template itself. (So, should both parameters be mistakenly used at once, df takes precedence.)

Examples:

{{death date and age |1993|2|24 |1921|4|12 |df=yes}} displays  "24 February 1993(1993-02-24) (aged 71)"
{{death date and age |1993|2|24 |1921|4|12 |mf=yes}} displays  "February 24, 1993(1993-02-24) (aged 71)"

Alternate template when specific birth date is unknown

When only the year of a person's death is known, or if it is desired not to state a person's full dates of birth and death (e.g. for privacy), use the template {{death year and age}} instead. See below for other templates that perform similar functions.

FAQ

  • Q: Why don't these templates add categories such as "Births in [Year]" to articles where they are used?
A: Because they are sometimes used for dates in lists of people (e.g. members of sports teams).

Background

The idea of using the template, as with {{birth date and age}} etc., is to allow for the inclusion of hidden metadata to be used, indexed or searched by software tools. However, as of October 2008 this template does not include any such metadata and never has since it was founded in December 2006. The apparent reason is that the hCard microformat, logically enough for an extension of "standard for electronic business cards", contains only "BDAY" field but nothing to do with a death. It is unclear when metadata standard for the dead will be developed and adopted. Until then, the template does nothing but format the input parameters.

Because the hCard specification requires the use of the Gregorian calendar, the template should not be used for dates stated in the Julian calendar.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Death date and age

This template returns a person's date of death and age at that date.

Template parameters

ParameterDescriptionTypeStatus
Year of death1

The year in which the person died

Numberrequired
Month of death2

The month (number) in which the person died

Numberrequired
Day of death3

The day (number) in which the person died

Numberrequired
Year of birth4

The year in which the person was born

Numberrequired
Month of birth5

The month (number) in which the person was born

Numberoptional
Day of birth6

The day (number) in which the person was born

Numberoptional
Day firstdf

When set to 'y' or 'yes', the date of death is output in a DMY format

Stringoptional
Month firstmf

When set to 'y' or 'yes', stresses that the default MDY date format is intended for the date of death

Stringoptional