Jump to content

Template talk:Death year and age/sandbox

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Theory

[edit]

If {{{5}}} exists, then assume 2009|8|31|1970|5 and generate age. If {{{5}}} does not exist, check if {{{4}}} exists.

If {{{4}}} exists,
If {{{3}}}>31 (so cannot be a month), then assume 2009|8|1970|5 and generate age.
If {{{3}}} not >31 (so must be a month), then assume 2009|8|31|1970 and generate age.
If {{{4}}} does not exist, check if {{{3}}} exists.
If {{{3}}} exists, assume 2009|8|1970 and generate age.
If {{{3}}} does not exist, assume 2009|1970 and generate age.

Check for existence of {{{5}}}

[edit]

{{#if:{{{5|}}} | {{#ifexpr:{{{2}}}<{{{5}}} | {{#expr:{{{1}}}-{{{4}}}-1}} | {{#ifexpr: {{{2}}}>{{{5}}} | {{#expr:{{{1}}}-{{{4}}} | {{#expr:{{{1}}}-{{{4}}}-1}}–{{#expr:{{{1}}}-{{{4}}}}} }} }} | <!--Check if {{{4}}} exists.--> }}

Check for existence of {{{4}}}

[edit]

{{#if:{{{4|}}} | {{#ifexpr:{{{3}}}>31 | {{#ifexpr:{{{2}}}<{{{4}}}|{{#expr:{{{1}}}-{{{3}}}-1}}|{{#ifexpr:{{{2}}}>{{{4}}}|{{#expr:{{{1}}}-{{{3}}}}}|{{#expr:{{{1}}}-{{{3}}}-1}}–{{#expr:{{{1}}}-{{{3}}}}} }} | {{#expr:{{{1}}}-{{{4}}}-1}}–{{{1}}}-{{{4}}}}} }} | <!--Check for existence of {{{3}}}-->}} }}

Check for existence of {{{3}}}

[edit]

{{#if:{{{3|}}}|<!--Assume [death year]|[death month]|[birth year]-->{{#expr:{{{1}}}-{{{3}}}-1}}–{{#expr:{{{1}}}-{{{3}}}}}|<!--Assume [death year]|[birth year]-->{{#expr:{{{1}}}-{{{2}}}-1}}–{{#expr:{{{1}}}-{{{2}}}}}}}

Putting it all together

[edit]

{{#if:{{{5|}}} | {{#ifexpr:{{{2}}}<{{{5}}} | {{#expr:{{{1}}}-{{{4}}}-1}} | {{#ifexpr: {{{2}}}>{{{5}}} | {{#expr:{{{1}}}-{{{4}}} | {{#expr:{{{1}}}-{{{4}}}-1}}–{{#expr:{{{1}}}-{{{4}}}}} }} }} | {{#if:{{{4|}}} | {{#ifexpr:{{{3}}}>31 | {{#ifexpr:{{{2}}}<{{{4}}}|{{#expr:{{{1}}}-{{{3}}}-1}}|{{#ifexpr:{{{2}}}>{{{4}}}|{{#expr:{{{1}}}-{{{3}}}}}|{{#expr:{{{1}}}-{{{3}}}-1}}–{{#expr:{{{1}}}-{{{3}}}}} }} | {{#expr:{{{1}}}-{{{4}}}-1}}–{{{1}}}-{{{4}}}}} }} | {{#if:{{{3|}}}|<!--Assume [death year]|[death month]|[birth year]-->{{#expr:{{{1}}}-{{{3}}}-1}}–{{#expr:{{{1}}}-{{{3}}}}}|<!--Assume [death year]|[birth year]-->{{#expr:{{{1}}}-{{{2}}}-1}}–{{#expr:{{{1}}}-{{{2}}}}}}} }} }} }}