Template:Death date and age/doc

< Template:Death date and age

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

<TemplateData> {

       "description": "This template returns a person's date of death and age at that date.",
       "params": {
               "1": {
                       "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>


There are a number of templates that you can use to set out a person's birth date or birth year, current age, death date or death year, and age at death. This is especially useful in infoboxes. Using these templates rather than simply inserting dates into articles allow hidden metadata about dates to be put into articles. Web browsers and other types of software can look up the metadata and use them for certain types of displays or searches.

The year, month and day of birth and death dates must be typed in numbers. If a number is smaller than ten, you do not have to type a zero before it (for example, you can type "7" instead of "07").

All the templates

What you should type Example What you will see
{{Birth date|[year of birth]|[month of birth]|[day of birth]}} {{Birth date|1965|8|9}} (1965-08-09)August 9, 1965
{{Birth date and age|[year of birth]|[month of birth]|[day of birth]}} {{Birth date and age|1965|8|9}} (1965-08-09) August 9, 1965 (age 59)
{{Birth year and age|[year of birth]|[optional month of birth, if known]}} {{Birth year and age|1965}} 1965 (age 58–59)
{{Birth year and age|1965|8}} August 1965 (age 59)
{{Death date|[year of death]|[month of death]|[day of death]}} {{Death date|2005|12|25}} December 25, 2005
{{Death date and age|[year of death]|[month of death]|[day of death]|[year of birth]|[month of birth]|[day of birth]}} {{Death date and age|2005|12|25|1965|8|9}} December 25, 2005(2005-12-25) (aged 40)
{{Death year and age|[year of death]|[year of birth]|[optional month of death, if known]}} {{Death year and age|2005|1965}} 2005 (aged 39–40)
{{Death year and age|2005|1965|12}} December 2005 (aged 39–40)

Notes

{{Birth date and age}} and {{Birth year and age}}

In {{Birth date and age}} and {{Birth year and age}}, the person's age is calculated based on the current date.

{{Birth year and age}} and {{Death year and age}}

The templates {{Birth year and age}} and {{Death year and age}} show a person's year of birth or death and his or her approximate (rough) age. The templates are useful when only the year of a person's birth and/or death are known, or if you do not want to state a person's full dates of birth and death for privacy reasons.

The person's age is estimated in the following way:

  • {{Birth year and age}} – let us assume:
  1. that the person in question was born some time in 1969; and
  2. that the present date is 23 November 2024.
If the person was born before 23 November 1969 then he will be 54 years old on 23 November 2024 as he has not had his 55th birthday yet. On the other hand, if he was born exactly on or before 23 November 1969, then he will be 55 years old.
Therefore, the template {{Birth year and age|1969}}
displays his birth year and age as: 1969 (age 54–55)
  • {{Death year and age}} – let us assume:
  1. that the person in question was born some time in 1973; and
  2. that she died some time in 2023.
We can think of two extremes: (1) that the person was born on 31 December 1973 and died on 1 January 2023, in which case she would have been 49 years old at the time of her death as she did not achieve her 50th birthday on 31 December 2023; and (2) that she was born on 1 January 1973 and died on 31 December 2023, in which case she would have been 50 years old at the time of her death as she had her 50th birthday on 1 January 2023.
Therefore, the template {{Death year and age|2023|1973}}
shows her death year and age as: 2023 (aged 49–50)

Templates allowing day to be shown before month

The templates in the table below take an optional parameter "df" (which stands for "date first") – you can choose whether to use it or not. If "df=yes", then the day of the date is shown before the month. This is for articles about people from parts of the world where the day usually comes before the month in a date.

What you should type Example What you will see
{{Birth date|[year of birth]|[month of birth]|[day of birth]|df=yes}} {{Birth date|1965|8|9|df=yes}} (1965-08-09)9 August 1965
{{Birth date and age|[year of birth]|[month of birth]|[day of birth]|df=yes}} {{Birth date and age|1965|8|9|df=yes}} (1965-08-09) 9 August 1965 (age 59)
{{Death date|[year of death]|[month of death]|[day of death]|df=yes}} {{Death date|2005|12|25|df=yes}} 25 December 2005
{{Death date and age|[year of death]|[month of death]|[day of death]|[year of birth]|[month of birth]|[day of birth]|df=yes}} {{Death date and age|2005|12|25|1965|8|9|df=yes}} 25 December 2005(2005-12-25) (aged 40)