Difference between revisions of "Template:Age in years"

From Speedsolving.com Wiki
m (Bryce Springfield moved page Template:Ageyears to Template:Age in years)
 
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}}}}}
 
{{#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}}}}}
  | &#32;{{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}}}}|}}<noinclude>== Usage ==
+
  | &#32;{{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}}}}|}}<noinclude>
 +
== Usage ==
 
<tt><nowiki>{{Age in years|2000}}</nowiki></tt> yields {{Age in years|2000}}.
 
<tt><nowiki>{{Age in years|2000}}</nowiki></tt> yields {{Age in years|2000}}.
 
<tt><nowiki>{{Age in years|1900|1950}}</nowiki></tt> yields {{Age in years|1900|1950}}.
 
<tt><nowiki>{{Age in years|1900|1950}}</nowiki></tt> yields {{Age in years|1900|1950}}.
  
 
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. </noinclude>
 
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. </noinclude>

Latest revision as of 01:42, 23 January 2018

2023–2024

Usage

{{Age in years|2000}} yields 23–24. {{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.