Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Birth year and age: Difference between revisions

Template page
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|}}}|{{#time:Y|{{{1}}}-01-01}}|}} (age {{#expr: {{#time:Y}} - {{{1|}}} }})</includeonly><noinclude>
<includeonly>{{#if:{{{2|}}}
This template displays the birth year and the current age of a person.
|{{MONTHNAME|{{{2}}}}}&nbsp;
 
}}{{{1}}} (age&nbsp;{{#if:{{{2|}}}
Usage:
|{{#ifexpr:{{CURRENTMONTH}}<{{{2}}}
{{Birth year and age|YYYY}}
  |{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}
 
  |{{#ifexpr:{{CURRENTMONTH}}>{{{2}}}
Parameters:
  |{{#expr:{{CURRENTYEAR}}-{{{1}}}}}
1 = Birth year (YYYY)
  |{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}&ndash;{{#expr:{{CURRENTYEAR}}-{{{1}}}}}
 
  }}
Example:
}}
{{Birth year and age|1975}}
|{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}&ndash;{{#expr:{{CURRENTYEAR}}-{{{1}}}}}
}})<!-- Error checks: -->{{#ifexpr: ( {{{1}}} > {{CURRENTYEAR}} ) OR ( {{CURRENTYEAR}} - {{{1}}} > 150 )
| &#32;{{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}}
}}{{#if:{{{2|}}}|{{#ifexpr: ( {{{2}}} > 12 ) OR ( {{{2}}} < 1 )
| &#32;{{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.

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.

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.