Template:Death date and age: Difference between revisions
From Vigyanwiki
m (Changed protection level of Template:Death date and age: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only administrators] (indefinite))) |
(Update from sandbox to add the ability to omit specifics of birth date) |
||
Line 1: | Line 1: | ||
<includeonly>{{#if:{{{df|}}}|{{#expr:{{{3}}}}} {{MONTHNAME|{{{2}}}}}|{{MONTHNAME|{{{2}}}}} {{#expr:{{{3}}}}},}} {{{1}}}<span style="display:none">(<span class="dday deathdate">{{{1}}}-{{padleft:{{MONTHNUMBER|{{{2}}}}}|2|0}}-{{padleft:{{{3}}}|2|0}}</span>)</span> (aged {{age|{{{4}}}|{{{5}}}|{{{6}}}|{{{1}}}|{{{2}}}|{{{3}}}}})<!-- | <includeonly>{{#if:{{{df|}}}|{{#expr:{{{3}}}}} {{MONTHNAME|{{{2}}}}}|{{MONTHNAME|{{{2}}}}} {{#expr:{{{3}}}}},}} {{{1}}}<span style="display:none">(<span class="dday deathdate">{{{1}}}-{{padleft:{{MONTHNUMBER|{{{2}}}}}|2|0}}-{{padleft:{{{3}}}|2|0}}</span>)</span> (aged {{#if:{{{5|}}} | ||
|{{#if:{{{6|}}} | |||
|<!-- if all birth values are specified -->{{age|{{{4}}}|{{{5}}}|{{{6}}}|{{{1}}}|{{{2}}}|{{{3}}}}} | |||
|{{#ifexpr:{{{2}}}<{{{5}}} | |||
|<!-- if birth month but not day exist and birth month was not reached in death year -->{{age|{{{4}}}|12|31|{{{1}}}|{{{2}}}|{{{3}}}}} | |||
|{{#ifexpr:{{{2}}}>{{{5}}}<!-- if birth month but not day exist and birth month was reached in death year --> | |||
|{{age|{{{4}}}|1|1|{{{1}}}|{{{2}}}|{{{3}}}}} | |||
|<!-- if birth month but not day exist and birth month is the death month -->{{age|{{{4}}}|12|31|{{{1}}}|{{{2}}}|{{{3}}}}}–{{age|{{{4}}}|1|1|{{{1}}}|{{{2}}}|{{{3}}}}} | |||
}} | |||
}} | |||
}} | |||
|{{Age in years|{{{4}}}|{{{1}}}}}}})<!-- | |||
-- Error checks -- | -- Error checks -- | ||
-->{{#ifexpr: ( {{{1|}}} > {{CURRENTYEAR}} ) OR ( {{{4|}}} > {{CURRENTYEAR}} ) OR ( {{{4|}}} > {{{1|}}} ) OR ( {{{1|}}} - {{{4|}}} > 150 ) | -->{{#ifexpr: ( {{{1|}}} > {{CURRENTYEAR}} ) OR ( {{{4|}}} > {{CURRENTYEAR}} ) OR ( {{{4|}}} > {{{1|}}} ) OR ( {{{1|}}} - {{{4|}}} > 150 ) | ||
|  {{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}} | |  {{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}} | ||
}}{{#ifexpr: ( {{{2|}}} > 12 ) OR ( {{{2|}}} < 1 ) OR ( {{{5|}}} > 12 ) OR ( {{{5|}}} < 1 ) | }}{{#if:{{{5|}}}|{{#ifexpr: ( {{{2|}}} > 12 ) OR ( {{{2|}}} < 1 ) OR ( {{{5|}}} > 12 ) OR ( {{{5|}}} < 1 ) | ||
|  {{error|invalid month}}{{main other|[[Category:Pages using age template with invalid date]]}} | |  {{error|invalid month}}{{main other|[[Category:Pages using age template with invalid date]]}}|}} | ||
}}{{#ifexpr: ( {{{3|}}} > 31 ) OR ( {{{3|}}} < 1 ) OR ( {{{6|}}} > 31 ) OR ( {{{6|}}} < 1 ) | }}{{#if:{{{6|}}}|{{#ifexpr: ( {{{3|}}} > 31 ) OR ( {{{3|}}} < 1 ) OR ( {{{6|}}} > 31 ) OR ( {{{6|}}} < 1 ) | ||
|  {{error|invalid day}}{{main other|[[Category:Pages using age template with invalid date]]}} | |  {{error|invalid day}}{{main other|[[Category:Pages using age template with invalid date]]}}|}} | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 00:27, 4 April 2015
Template documentation
[create]