Difference between revisions of "Template:Age in years"

From blackwiki
Jump to navigation Jump to search
blackwiki>Ritchie333
m (Protected Template:Age in years: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)))
blackwiki>Johnuniq
(replace with code to invoke Module:Age to improve consistency and error checking for the age templates)
Line 1: Line 1:
{{#ifeq: {{{1}}} | {{{2|{{CURRENTYEAR}}}}} |0|{{#expr:{{age|{{{1|0}}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|{{{2|{{CURRENTYEAR}}}}}}}-1}}–{{age|{{{1|0}}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|{{{2|{{CURRENTYEAR}}}}}}}}}<!-- Error checks: -->{{#if:{{{1|}}}|{{#ifexpr: {{{1}}} > {{{2|{{CURRENTYEAR}}}}}
+
{{#invoke:age|age_generic|template=age_in_years}}<noinclude>
| &#32;{{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}}}}|}}<noinclude>{{doc}}</noinclude>
+
{{Documentation}}
 +
</noinclude>

Revision as of 08:11, 28 February 2018

0

Template documentation[view] [edit] [history] [purge]

Usage

{{Age in years|2000}} yields 24–25. {{Age in years|1900|1950}} yields 49–50.

Note that the template provides an age range: during the year 2015, someone born in 2000 is either 14 or 15 years old, depending on whether they have passed their birth date in the later year.

See also