Template:AgeFull: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (ah, using relative paths causes the transcluding page to look for those pages relative to itself)
m (original template name has changed to something that's actually logical)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#if:{{{year|}}}
<includeonly>{{#if:{{{year|}}}
  |{{#if:{{{month|}}}
  |{{#if:{{{month|}}}
   |{{#if:{{{day|}}}
   |{{#if:{{{day|}}}
Line 26: Line 26:
     |{{#expr:{{CURRENTDAY}}-{{{day}}}
     |{{#expr:{{CURRENTDAY}}-{{{day}}}
       }}
       }}
     |{{#expr:{{Gregorian serial date
     |{{#expr:{{Gsd
       |year={{CURRENTYEAR}}
       |year={{CURRENTYEAR}}
       |month={{CURRENTMONTH}}
       |month={{CURRENTMONTH}}
       |day={{CURRENTDAY}}}}-{{Gregorian serial date
       |day={{CURRENTDAY}}}}-{{Gsd
       |year={{CURRENTYEAR}}
       |year={{CURRENTYEAR}}
       |month={{#expr:{{CURRENTMONTH}}-1}}
       |month={{#expr:{{CURRENTMONTH}}-1}}
Line 69: Line 69:
   }}
   }}
  |some time
  |some time
}}
}}</includeonly><noinclude>Copied from Wikipedia's [[wp:Template:Age in years, months and days|Age in years, months and days]] template. The three parameters are "year", "month", and "day", all optional. Here's what happens if you supply a specific date:
 
"Oni is <nowiki>{{AgeFull|year=2001|month=1|day=29}}</nowiki> old"<br />
yields<br />
Oni is {{AgeFull|year=2001|month=1|day=29}} old
 
whereas "Oni is <nowiki>{{AgeFull|year=2001|month=1}}</nowiki> old"<br />
yields<br />
Oni is {{AgeFull|year=2001|month=1}} old
 
and "Oni is <nowiki>{{AgeFull|year=2001}}</nowiki> old"<br />
yields<br />
Oni is {{AgeFull|year=2001}} old
 
If you're content with just getting an age in whole years and you don't want the equivocating "X or Y years old", use the simpler template [[Template:Age]].
 
[[Category:Utility templates]]</noinclude>

Latest revision as of 02:31, 28 June 2022

Copied from Wikipedia's Age in years, months and days template. The three parameters are "year", "month", and "day", all optional. Here's what happens if you supply a specific date:

"Oni is {{AgeFull|year=2001|month=1|day=29}} old"
yields
Oni is 23 years, 9 months, and 27 days old

whereas "Oni is {{AgeFull|year=2001|month=1}} old"
yields
Oni is 23 years and 9 or 10 months old

and "Oni is {{AgeFull|year=2001}} old"
yields
Oni is 22 or 23 years old

If you're content with just getting an age in whole years and you don't want the equivocating "X or Y years old", use the simpler template Template:Age.