Template:Birth based on age as of date/doc: Difference between revisions
m →Examples: ce |
m rm repetition |
||
(36 intermediate revisions by 22 users not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} |
{{Documentation subpage}} |
||
<!-- PLEASE ADD CATEGORIES |
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> |
||
{{ |
{{High-use}} |
||
{{Intricate template}} |
|||
=== Usage === |
|||
This template calculates the birth year and current age based on the age as of a date. This is useful when a reference states only their age at the time of the reference's publication. |
|||
For a person whose date of birth is unknown, this template estimates the person's birth year and current age based on a given age at a certain date. This is useful when a [[wp:reliable source|reliable source]] states only their age at the time of publication. |
|||
===Syntax=== |
|||
<pre> |
|||
{{Birth based on age as of date|age|year|month|day}} |
|||
</pre> |
|||
{{Notice|This template is appropriate in cases where sources from '''only one''' point in time are available.}} |
|||
The age, year, and day must be supplied as [[natural number]]s; month can be specified as a natural number as well as by name or abbreviation (e.g. "August" or "Aug"). The [[Gregorian calendar]] is assumed, with no special support provided for [[dual dating]] or the difference between [[Old Style and New Style dates]] . |
|||
If you have reason to believe the subject's age has been discussed by sources ''at more than one point in time'', consider not using this template which, by definition, introduces a whole year's worth of error margin. For example, if a reliable source on May 1st, 2010 states Mr X is 29 years old and a different source on August 1st, 2020 states Mr X is 40 years old, then you can establish that Mr X was born no earlier than May 2nd, 1980. Using this template would in both instances suggest a birth year of 1979 or 1980. Since you know the former to be incorrect, using this template would be inappropriate. |
|||
===Examples=== |
|||
For example, if a reference dated July 4, {{#expr: {{CURRENTYEAR}} - 1}} mentions that someone is 50 years old, that person's birth year and age can be rendered using |
|||
<nowiki>{{Birth based on age as of date|50|</nowiki>{{#expr: {{CURRENTYEAR}} - 1}}|July|4}} |
|||
{{Notice|This template is intended for living people.}} |
|||
{| class="wikitable plainlinksneverexpand noprint" style="margin-top:0; width:100%; text-align:center;" |
|||
|- |
|||
! colspan="6" style="background:#dfd;"| |
|||
The following examples use a date which is exactly one year before:<br> |
|||
{{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} |
|||
|} |
|||
If the subject has died, please use {{tl|Birth based on age at death}} instead of this template. While {{asof|2024|lc=y}} that template is just a wrapper of this one, this leaves open the possibility to use that template to recategorize the subject. Also, it makes sure you don't forget to suppress the age field. |
|||
{| class=wikitable width=100% |
|||
|- |
|||
== Syntax == |
|||
! width=70% | Template text |
|||
=== Typical use === |
|||
! width=30% | Result |
|||
<syntaxhighlight lang="wikitext"> {{birth based on age as of date | age | year | month | day }} </syntaxhighlight> |
|||
|- |
|||
<div style="margin-left:1.6em;">Code:</div> |
|||
| align=center | <tt><nowiki>{{Birth based on age as of date|50|</nowiki>{{#expr: {{CURRENTYEAR}} - 1}}|{{#expr: {{CURRENTMONTH}}}}|{{CURRENTDAY}}}}</tt> |
|||
<div style="margin-left:3.2em;"><code><nowiki>{{birth based on age as of date|50|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}<nowiki>}}</nowiki></code></div> |
|||
<div style="margin-left:1.6em;">Result:</div> |
|||
|- |
|||
<div style="margin-left:3.2em;">{{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}}} |
|||
</div> |
|||
| align=center | {{Birth based on age as of date|50|{{#expr: {{CURRENTYEAR}} - 1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}} |
|||
The age, year, and day must be supplied as [[natural number]]s; month can be specified as a natural number as well as by name or abbreviation (e.g. "August" or "Aug"). The [[Gregorian calendar]] is assumed, with no special support provided for [[dual dating]] or the difference between [[Old Style and New Style dates]]. |
|||
|- |
|||
| align=center | <tt><nowiki>{{Birth based on age as of date|50|</nowiki>{{#expr: {{CURRENTYEAR}} - 1}}|1|15}}</tt> |
|||
If only the publication year for a source is known, the "day" and "month" fields can be omitted. |
|||
| align=center | {{Birth based on age as of date|50|{{#expr: {{CURRENTYEAR}} - 1}}|1|15}} |
|||
|- |
|||
=== No age === |
|||
| align=center | <tt><nowiki>{{Birth based on age as of date|50|</nowiki>{{#expr: {{CURRENTYEAR}} - 1}}|Nov|5}}</tt> |
|||
In some contexts—like the lead sentence of a biography—it may be desirable to show only the birth year, and not a person’s age. To suppress the age field, set {{para|noage|yes}}: |
|||
| align=center | {{Birth based on age as of date|50|{{#expr: {{CURRENTYEAR}} - 1}}|11|5}} |
|||
<div style="margin-left:1.6em;">Code:</div> |
|||
<div style="margin-left:3.2em;"><code><nowiki>{{birth based on age as of date|50|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}|noage=1|slash=y<nowiki>}}</nowiki></code></div> |
|||
<div style="margin-left:1.6em;">Result:</div> |
|||
<div style="margin-left:3.2em;">{{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}|noage=1|slash=yes}}</div> |
|||
=== Separator === |
|||
In general, the two possible birth years should be written out as: {{xt|1950 or 1951}}. In contexts which are tight for space, the separator between the two possible years should be a slash: {{xt|1950/1951}}. |
|||
To use the <code>/</code> separator, add {{para|slash|yes}}. |
|||
<div style="margin-left:1.6em;">Code:</div> |
|||
<div style="margin-left:3.2em;"><code><nowiki>{{birth based on age as of date|50|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}|slash=yes<nowiki>}}</nowiki></code></div> |
|||
<div style="margin-left:1.6em;">Result:</div> |
|||
<div style="margin-left:3.2em;">{{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-2}}|{{#expr:12-{{CURRENTMONTH}}+1}}|{{CURRENTDAY}}|slash=yes}}</div> |
|||
== Examples == |
|||
If, for example, a reference dated July 4, {{#expr:{{CURRENTYEAR}}-2}} mentions that someone is 50 years old, that person's birth year and age can be rendered using: |
|||
<div style="margin-left:1.6em;"><code><nowiki>{{birth based on age as of date|50|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}|July|4}}</code></div> |
|||
{| class="plainlinksneverexpand" style="margin-top:0;" |
|||
!style="border:1px solid #aaa;background:#dfd;"| |
|||
The following examples are for a person reported as being 50 years old in {{#expr:{{CURRENTYEAR}}-1}} |
|||
|- |
|- |
||
| |
|||
{{Aligned table |
|||
|class=wikitable |colstyle=padding-right:1.0em; |
|||
|col1style=font-family:monospace;padding-right:1.0em; |
|||
|row1header=on| {{sans-serif|Template code}} | Result |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTHNAME}}|{{CURRENTDAY}}}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTHNAME}}|{{CURRENTDAY}}}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12|31}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12|31}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan|1}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan|1}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12|31|noage{{=}}1}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12|31|noage=1}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan|1|noage{{=}}1}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan|1|noage=1}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTHNAME}}}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTHNAME}}}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|Jan}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}|12}} |
|||
| {{braces|birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}}} |
|||
| {{birth based on age as of date|50|{{#expr:{{CURRENTYEAR}}-1}}}} |
|||
}} |
|||
|} |
|} |
||
{{Birth, death and age templates |BDA}} |
|||
=== See also === |
|||
* [[Wikipedia:Age calculation templates]] |
|||
; Birth, death, age |
|||
* {{tl|BirthDeathAge}} – carries out the functions of this template and all the following ones |
|||
* {{tl|Birth date}} – displays the date and related hidden metadata |
|||
* {{tl|Birth date and age}} – same as {{tl|Birth date}}, except that "(age ##)" appears after the birth date |
|||
* {{tl|Birth date and age2}} – displays birth date, plus age as of a specified date, "(aged ##)" appears after the birth date |
|||
* {{tl|Birth year and age}} – year of birth and approximate age |
|||
* {{tl|Birth-date and age}} – display birth date and age, accepts dates as text (15 June 1950; June 15, 1950; June 1950; etc.) |
|||
* {{tl|Death date}} – displays the date and related hidden metadata |
|||
* {{tl|Death date and age}} – same as {{tl|Death date}}, except that "(aged ##)" appears after the death date |
|||
* {{tl|Death year and age}} – year of death and approximate age at death |
|||
* {{tl|Death-date and age}} – display death date and age, accepts date as text (15 June 1950; June 15, 1950; June 1950; etc.) |
|||
; Age only |
|||
* {{tl|Age}} – age based on the number of full years between two dates (or a specified date and current date) |
|||
* {{tl|Age nts}} – similar to the above, but will sort correctly in sortable tables |
|||
* {{tl|Age in years and days}} – full years and days between two dates (or a specified date and current date) |
|||
* {{tl|Age in days}} – age in days between two dates (or a specified date and current date) |
|||
* {{tl|Age as of date}} – current age in years, based on a known age as of a specified date |
|||
<includeonly> |
|||
<!--PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE. THANKS.--> |
|||
<includeonly>{{Sandbox other| |
|||
[[Category:Date mathematics templates|{{PAGENAME}}]] |
|||
| <!--PLEASE ADD CATEGORIES BELOW THIS LINE: --> |
|||
[[Category:Date mathematics templates]] |
|||
}}</includeonly> |
|||
<templatedata> |
|||
{ |
|||
"params": { |
|||
"1": { |
|||
"label": "Age", |
|||
"description": "Age of subject at date of reference's publication.", |
|||
"example": "55", |
|||
"type": "number", |
|||
"required": true |
|||
}, |
|||
"2": { |
|||
"label": "Year", |
|||
"description": "Year of publication of reference.", |
|||
"example": "1950", |
|||
"type": "number", |
|||
"required": true |
|||
}, |
|||
"3": { |
|||
"label": "Month", |
|||
"description": "Month of publication of reference.", |
|||
"example": "8 or August", |
|||
"type": "string", |
|||
"suggested": true |
|||
}, |
|||
"4": { |
|||
"label": "Day", |
|||
"description": "Day of publication of reference.", |
|||
"example": "21", |
|||
"type": "number", |
|||
"suggested": true |
|||
}, |
|||
"noage": { |
|||
"label": "Hide age", |
|||
"description": "Set to a value of 'yes' to display year of birth without the age", |
|||
"example": "1", |
|||
"type": "boolean", |
|||
"default": "no (i.e., the default is to show the age)" |
|||
}, |
|||
"slash": { |
|||
"label": "Slash separator", |
|||
"description": "Set to 'yes' to separate years with a '/' for tight spaces (e.g., table cells)", |
|||
"suggestedvalues": [ |
|||
"yes" |
|||
], |
|||
"type": "boolean", |
|||
"default": "no" |
|||
} |
|||
}, |
|||
"description": "This template calculates the birth year and current age based on the age as of a date.", |
|||
"format": "inline", |
|||
"paramOrder": [ |
|||
"1", |
|||
"2", |
|||
"3", |
|||
"4", |
|||
"noage", |
|||
"slash" |
|||
] |
|||
} |
|||
</templatedata> |
|||
==Redirects== |
|||
</includeonly> |
|||
* [[Template:Bbad]] |
|||
* [[Template:Birth year from age as of date]] |
|||
* [[Template:Birth year from age at date]] |
Latest revision as of 14:50, 31 August 2024
![]() | This is a documentation subpage for Template:Birth based on age as of date. It may contain usage information, categories and other content that is not part of the original template page. |
![]() | This template is used on approximately 6,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
![]() | This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
For a person whose date of birth is unknown, this template estimates the person's birth year and current age based on a given age at a certain date. This is useful when a reliable source states only their age at the time of publication.
![]() | This template is appropriate in cases where sources from only one point in time are available. |
If you have reason to believe the subject's age has been discussed by sources at more than one point in time, consider not using this template which, by definition, introduces a whole year's worth of error margin. For example, if a reliable source on May 1st, 2010 states Mr X is 29 years old and a different source on August 1st, 2020 states Mr X is 40 years old, then you can establish that Mr X was born no earlier than May 2nd, 1980. Using this template would in both instances suggest a birth year of 1979 or 1980. Since you know the former to be incorrect, using this template would be inappropriate.
![]() | This template is intended for living people. |
If the subject has died, please use {{Birth based on age at death}} instead of this template. While as of 2024[update] that template is just a wrapper of this one, this leaves open the possibility to use that template to recategorize the subject. Also, it makes sure you don't forget to suppress the age field.
Syntax
[edit]Typical use
[edit] {{birth based on age as of date | age | year | month | day }}
{{birth based on age as of date|50|2022|3|29}}
The age, year, and day must be supplied as natural numbers; month can be specified as a natural number as well as by name or abbreviation (e.g. "August" or "Aug"). The Gregorian calendar is assumed, with no special support provided for dual dating or the difference between Old Style and New Style dates.
If only the publication year for a source is known, the "day" and "month" fields can be omitted.
No age
[edit]In some contexts—like the lead sentence of a biography—it may be desirable to show only the birth year, and not a person’s age. To suppress the age field, set |noage=yes
:
{{birth based on age as of date|50|2022|3|29|noage=1|slash=y}}
Separator
[edit]In general, the two possible birth years should be written out as: 1950 or 1951. In contexts which are tight for space, the separator between the two possible years should be a slash: 1950/1951.
To use the /
separator, add |slash=yes
.
{{birth based on age as of date|50|2022|3|29|slash=yes}}
Examples
[edit]If, for example, a reference dated July 4, 2022 mentions that someone is 50 years old, that person's birth year and age can be rendered using:
{{birth based on age as of date|50|2022|July|4}}
The following examples are for a person reported as being 50 years old in 2023 | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
This template calculates the birth year and current age based on the age as of a date.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Age | 1 | Age of subject at date of reference's publication.
| Number | required |
Year | 2 | Year of publication of reference.
| Number | required |
Month | 3 | Month of publication of reference.
| String | suggested |
Day | 4 | Day of publication of reference.
| Number | suggested |
Hide age | noage | Set to a value of 'yes' to display year of birth without the age
| Boolean | optional |
Slash separator | slash | Set to 'yes' to separate years with a '/' for tight spaces (e.g., table cells)
| Boolean | optional |