Changes
Template:Birth based on age as of date/doc (view source)
Revision as of 03:15, 11 February 2018
, 6 years agoReverted edits by 2600:1:914A:395F:53ED:74BF:634C:67DA (talk) to last version by Kb.au
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
{{Intricate template}}
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.
===Syntax===
<pre> {{birth based on age as of date |age |year|month|day}} </pre>
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 they are not known, the "day" and "month" fields can be omitted; this is useful if, for example, only the publication year for a source is known.
===Options===
To suppress the age field:
<pre> {{birth based on age as of date |age |year|month|day |noage=1}} </pre>
With the "noage=1" option, the month and day can be "1".
To replace the '/' separator with ' or ' in compliance with [[WP:APPROXDATE]], add {{para|mos|1}}
:<code><nowiki>{{birth based on age as of date|50 |</nowiki>{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|mos=1}}</code>
::{{birth based on age as of date|50 |{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|mos=1}}
===Examples===
If, for example, 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}}
{| 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}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
| <!--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
},
"mos": {
"label": "MOS compliance",
"description": "Set to a value of 1 to replace the '/' separator with ' or ' in compliance with [[WP:APPROXDATE]].",
"example": "1",
"type": "number"
},
"noage": {
"label": "Hide age",
"description": "Set to a value of 1 to display year of birth without the age.",
"example": "1",
"type": "number"
}
},
"description": "This template calculates the birth year and current age based on the age as of a date.",
"format": "inline"
}
</templatedata>
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
{{Intricate template}}
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.
===Syntax===
<pre> {{birth based on age as of date |age |year|month|day}} </pre>
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 they are not known, the "day" and "month" fields can be omitted; this is useful if, for example, only the publication year for a source is known.
===Options===
To suppress the age field:
<pre> {{birth based on age as of date |age |year|month|day |noage=1}} </pre>
With the "noage=1" option, the month and day can be "1".
To replace the '/' separator with ' or ' in compliance with [[WP:APPROXDATE]], add {{para|mos|1}}
:<code><nowiki>{{birth based on age as of date|50 |</nowiki>{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|mos=1}}</code>
::{{birth based on age as of date|50 |{{#expr:{{CURRENTYEAR}}-1}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|mos=1}}
===Examples===
If, for example, 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}}
{| 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}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
| <!--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
},
"mos": {
"label": "MOS compliance",
"description": "Set to a value of 1 to replace the '/' separator with ' or ' in compliance with [[WP:APPROXDATE]].",
"example": "1",
"type": "number"
},
"noage": {
"label": "Hide age",
"description": "Set to a value of 1 to display year of birth without the age.",
"example": "1",
"type": "number"
}
},
"description": "This template calculates the birth year and current age based on the age as of a date.",
"format": "inline"
}
</templatedata>