Open main menu

Changes

Template:Birth year and age

1,451 bytes added, 03:48, 19 January 2019
update Wikidata tracking, tested with /sandbox and articles
<includeonly>{{#if:{{{2|}}}
|{{MONTHNAME|{{{2}}}}}&nbsp;
}}{{{1}}} (age&nbsp;{{#if:{{{2|}}}
|{{#ifexpr:{{CURRENTMONTH}}<{{{2}}}
|{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}
|{{#ifexpr:{{CURRENTMONTH}}>{{{2}}}
|{{#expr:{{CURRENTYEAR}}-{{{1}}}}}
|{{#expr:{{CURRENTYEAR}}-{{{1}}}-1}}&ndash;{{#expr:{{CURRENTYEAR}}-{{{1}}}}}
}}
}}
|{{#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>
Anonymous user