Template:Birth year and age: Difference between revisions
Template page
More actions
Created page with "<includeonly>{{#if:{{{1|}}}|{{#time:Y|{{{1}}}-01-01}}|}} (age {{#expr: {{#time:Y}} - {{{1|}}} }})</includeonly><noinclude> This template displays the birth year and the current age of a person. Usage: {{Birth year and age|YYYY}} Parameters: 1 = Birth year (YYYY) Example: {{Birth year and age|1975}} </noinclude>" |
m Protected "Template:Birth year and age" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{#if:{{{1|}}}|{{# | <includeonly>{{#if:{{{2|}}} | ||
|{{MONTHNAME|{{{2}}}}} | |||
}}{{{1}}} (age {{#if:{{{2|}}} | |||
|{{#ifexpr:{{CURRENTMONTH}}<{{{2}}} | |||
{{Birth year and age| | |{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}} | ||
|{{#ifexpr:{{CURRENTMONTH}}>{{{2}}} | |||
|{{#expr:{{CURRENTYEAR}}-{{{1}}}}} | |||
|{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}–{{#expr:{{CURRENTYEAR}}-{{{1}}}}} | |||
}} | |||
}} | |||
{{ | |{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}–{{#expr:{{CURRENTYEAR}}-{{{1}}}}} | ||
}})<!-- Error checks: -->{{#ifexpr: ( {{{1}}} > {{CURRENTYEAR}} ) OR ( {{CURRENTYEAR}} - {{{1}}} > 150 ) | |||
|  {{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}} | |||
}}{{#if:{{{2|}}}|{{#ifexpr: ( {{{2}}} > 12 ) OR ( {{{2}}} < 1 ) | |||
|  {{error|invalid month}}{{main other|[[Category:Pages using age template with invalid date]]}}|}} | |||
}}{{#invoke:Check for unknown parameters|check|ignoreblank=y|preview=Page using [[Template:Birth year and age]] with unknown parameter "_VALUE_"|unknown={{main other|[[Category:Pages using birth year and age template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|1|2}}{{#ifeq: {{NAMESPACENUMBER}} | 0 | |||
| {{#if: {{#invoke:Wikidata|pageId}} | |||
| {{#if: {{#invoke:String|match|{{#invoke:Wikidata|getPropertyIDs|P31|FETCH_WIKIDATA}},|Q5,|1|1|true|}} | |||
| {{#if: {{#property:P569}} | |||
| | |||
| [[Category:Date of birth not in Wikidata]] | |||
}} | |||
}} | |||
| [[Category:Articles without Wikidata item]] | |||
}} | |||
}}</includeonly><noinclude> | |||
{{Documentation}} | |||
</noinclude> | </noinclude> | ||
Latest revision as of 05:25, 1 December 2025
Your wiki got a version of Template:Documentation that is only relevant to Templates Wiki! Click here to revert it.
For a documentation template you can use on your wiki, see Template:Documentation (copy) on Templates Wiki.
Template information, documentation, and installation instructions.
Expand the below text for usage and other information.
Expand the below text for usage and other information.
Template Documentation:
Note: The template above might be broken without the parameters; this is normal.
Create documentation for this template. (How does this work?)
Editors can experiment with this template's sandbox and testcases.
Create documentation for this template. (How does this work?)
Editors can experiment with this template's sandbox and testcases.
Documentation does not exist. Create it at Template:Birth year and age/doc .
Installation Instructions
- Export this template, then import to install it.
Use edit summary:Copied from [[w:c:templates:Template:Birth year and age]]to properly attribute this template's editors.
- There is no additional installation instructions for this template. If there is any, you may create it at Template:Birth year and age/install.