Template:Age: Difference between revisions

From Inkipedia, the Splatoon wiki
(changed category to Inline Templates)
(changing description to be more representative of the templates use)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
A template that automatically calculates people's age based on their date of birth, or other lengths of time in years.
A template that automatically calculates people's age in years based on their date of birth.


== Usage ==
== Usage ==
Line 13: Line 13:
| The year the person was born in.
| The year the person was born in.
|-
|-
| <code>category</code> || Unnamed, '''required'''.
| <code>month</code> || Unnamed, '''required'''.
| The month the person was born in.
| The month the person was born in.
|-
|-
Line 30: Line 30:


=== Examples ===
=== Examples ===
<code><nowiki>{{Age|2015|5|28}}</nowiki></code> → {{S}} is {{Age|2015|5|28}} years old.
{{S}} is <code><nowiki>{{Age|2015|5|28}}</nowiki></code> years old. → {{S}} is {{Age|2015|5|28}} years old.


<code><nowiki>{{Age|2015|8|5|2017|9|30}}</nowiki></code> → The first [[Splatnet]] existed for {{Age|2015|8|5|2017|9|30}} years.
The first [[Splatnet]] existed for <code><nowiki>{{Age|2015|8|5|2017|9|30}}</nowiki></code> years. → The first [[Splatnet]] existed for {{Age|2015|8|5|2017|9|30}} years.


[[Category:Inline templates]]</noinclude>
[[Category:Inline templates]]</noinclude>

Latest revision as of 20:50, 2 July 2023

A template that automatically calculates people's age in years based on their date of birth.

Usage

{{Age|<year>|<month>|<day>|<death_year>|<death_month>|<death_day>}}

Parameters

All the parameters must be numbers for the expression to work.

year Unnamed, required. The year the person was born in.
month Unnamed, required. The month the person was born in.
day Unnamed, required. The number of the day the person was born on.
death_year Unnamed, optional. If included, will replace the current year.
death_month Unnamed, optional. If included, will replace the current month's number.
death_day Unnamed, optional. If included, will replace the current day's number.

Examples

Splatoon is {{Age|2015|5|28}} years old. → Splatoon is 9 years old.

The first Splatnet existed for {{Age|2015|8|5|2017|9|30}} years. → The first Splatnet existed for 2 years.