Misplaced Pages

Template:Death date and age/sandbox

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Template:Death date and age

This is an old revision of this page, as edited by Rich Farmbrough (talk | contribs) at 19:47, 8 August 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 19:47, 8 August 2011 by Rich Farmbrough (talk | contribs)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


This is the template sandbox page for Template:Death date and age (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 433,000 pages, or roughly 1% of all pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
Do NOT use this template when the person's exact date of death is disputed or unknown; consider {{death year and age}} instead.
Shortcut
This template uses Lua:

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 " 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 for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Death date and age in articles based on its TemplateData.

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

See also

Birth, death and age templates
birth, death, age
Combined BDA template Description / use 
{{BirthDeathAge}}Combines functions of {{Birth date}}, {{birth-date}}, {{birth date and age}}, {{birth year and age}}, {{death date}}, {{death-date}}, {{death date and age}}, and {{death year and age}}.
Birth templates Description / use 
{{Birth date}}To display a birth date and related hidden metadata.
{{Birth-date}}
{{Birth date and age}}{{Birth date}} with suffix '(age N)'.
{{Birth date and age2}}{{Birth date and age}} plus age as of a specified date.
{{Birth-date and age}}As {{Birth date and age}}, but accepts dates in text form ('15 June 1950', 'June 15, 1950', 'June 1950', etc.).
{{Birth date and age in years and days}}{{Birth date and age}}, but with the age displayed in years and days rather than just years.
{{Birth year and age}}Year of birth and approximate age.
{{Birth based on age as of date}}To display approximate birth year and current age given a particular date (e.g. when a dated reference mentions the age of a person), only works for living people.
{{Birth based on age as of dates}}To display approximate birth year and current age given several particular dates (e.g. when a dated reference mentions the age of a person), only works for living people.
{{Birth based on age at death}}To display approximate birth year based on age at death, or on age at a specific date if death date isn't known.
Death templates Description / use 
{{Death date}}To display a death date and related hidden metadata.
{{Death-date}}
{{Death date and age}}{{Death date}} with suffix '(aged N)'; also called with {{event date and age}}.
{{Death-date and age}}As {{Death date and age}}, but accepts dates in text form ('15 June 1950', 'June 15, 1950', 'June 1950', etc.).
{{Death date and given age}}To display a death date and specified age.
{{Death year and age}}To display a year of, and approximate age at death.
age only
Conventional age templates Description / use 
{{Age in years, months, weeks and days}}Number of complete years, months, weeks and days between two dates.
{{Age in years, months and days}}Number of complete years, months and days between two dates.
{{Age in years and months}}Number of complete years and remaining months between two dates.
{{Age in years and days}}Number of complete years and remaining days between two dates.
{{Age in years and days nts}}{{Age in years and days}} with output formatted for use in number sortable tables.
{{Age in decimal years}}Number of years between two dates, rounded to the specified number of decimal places.
{{Age in years}}Number of years between two dates.
{{Age in years nts}}{{Age in years}} with output formatted for use in number sortable tables.
{{Age in months}}Number of months between two dates.
{{Age in weeks and days}}Number of weeks and days between two dates.
{{Age in weeks}}Number of weeks between two dates.
{{Age in days}}Age in days between two dates.
{{Age in days nts}}{{Age in days}} with output formatted for use in number sortable tables.
Reverse-determined age template Description / use 
{{Age}}Age based on number of complete years between two dates.
{{Age nts}}{{Age}} with output formatted for use in number sortable tables.
{{Age as of date}}Current age (in years) from a known age at a specified date.
{{Age for infant}}Current age for infant: months and days up to one year, years and months up to three years, and years beyond age 3.
start / end dates
Date-focused templates Description / use 
{{Start date}} / {{End date}}
{{Start-date}} / {{End-date}}
{{Start date and age}}
{{End date and age}}
miscellaneous
Template Description / use 
{{OldStyleDate}}Dates in Julian calendar.
{{OldStyleDateDY}}As {{OldStyleDate}} but used when Julian / Gregorian dates fall in different years.
{{OldStyleDateNY}}As {{OldStyleDate}} but without the year.
{{Unidentified for}}
{{Missing for}}
The above documentation is transcluded from Template:Death date and age/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.


Category: