Template:AgeFull: Difference between revisions
Jump to navigation
Jump to search
m (oops, that's the WP template name) |
m (original template name has changed to something that's actually logical) |
||
(7 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|}}} | ||
|{{/display | |{{AgeFull/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}-{{#ifexpr:{{CURRENTMONTH}}>{{{month}}} | |years={{#expr:{{CURRENTYEAR}}-{{{year}}}-{{#ifexpr:{{CURRENTMONTH}}>{{{month}}} | ||
|0 | |0 | ||
Line 26: | Line 26: | ||
|{{#expr:{{CURRENTDAY}}-{{{day}}} | |{{#expr:{{CURRENTDAY}}-{{{day}}} | ||
}} | }} | ||
|{{#expr:{{ | |{{#expr:{{Gsd | ||
|year={{CURRENTYEAR}} | |year={{CURRENTYEAR}} | ||
|month={{CURRENTMONTH}} | |month={{CURRENTMONTH}} | ||
|day={{CURRENTDAY}}}}-{{ | |day={{CURRENTDAY}}}}-{{Gsd | ||
|year={{CURRENTYEAR}} | |year={{CURRENTYEAR}} | ||
|month={{#expr:{{CURRENTMONTH}}-1}} | |month={{#expr:{{CURRENTMONTH}}-1}} | ||
Line 39: | Line 39: | ||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | ||
|0 years | |0 years | ||
|{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{/display | |{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{AgeFull/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | ||
}} | }} | ||
Line 46: | Line 46: | ||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | ||
|<!--null value--> | |<!--null value--> | ||
|{{/display | |{{AgeFull/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | ||
}} and | }} and | ||
}} {{#expr:{{CURRENTMONTH}}-{{{month}}}-1}} or {{/display | }} {{#expr:{{CURRENTMONTH}}-{{{month}}}-1}} or {{AgeFull/display | ||
|months={{#expr:{{CURRENTMONTH}}-{{{month}}}}} | |months={{#expr:{{CURRENTMONTH}}-{{{month}}}}} | ||
}} | }} | ||
|{{#ifexpr:{{CURRENTYEAR}}={{#expr:{{{year}}}+1}} | |{{#ifexpr:{{CURRENTYEAR}}={{#expr:{{{year}}}+1}} | ||
|<!--null value--> | |<!--null value--> | ||
|{{/display | |{{AgeFull/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} | |years={{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} | ||
}} and | }} and | ||
Line 63: | Line 63: | ||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | ||
|0 years | |0 years | ||
|{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{/display | |{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{AgeFull/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | ||
}} | }} | ||
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 and 10 months 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.