Difference between revisions of "Template:Age in years and months/sandbox"

From blackwiki
Jump to navigation Jump to search
blackwiki>WOSlinker
(test)
blackwiki>Johnuniq
(test with Module:Age/sandbox)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}=0|{{#ifeq:{{{s0y|}}}|yes|0 years,&nbsp;|}}|{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}} year{{#ifeq:{{#expr:({{{4|{{CURRENTYEAR}}}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}|1||s}}{{#ifexpr:{{#expr:{{#ifexpr:{{{5|{{CURRENTMONTH}}}}}<={{{2}}}|12|0}} + ({{{5|{{CURRENTMONTH}}}}}-{{{2}}}) + {{#ifexpr:{{{6|{{CURRENTDAY}}}}}>={{{3}}}|1|0}} -1 }}<=0||,&nbsp;}}}}{{#ifexpr:{{#expr:{{#ifexpr:{{{5|{{CURRENTMONTH}}}}}<={{{2}}}|12|0}} + ({{{5|{{CURRENTMONTH}}}}}-{{{2}}}) + {{#ifexpr:{{{6|{{CURRENTDAY}}}}}>={{{3}}}|1|0}} -1 }}<=0||{{#expr:{{#ifexpr:{{{5|{{CURRENTMONTH}}}}}<={{{2}}}|12|0}} + ({{{5|{{CURRENTMONTH}}}}}-{{{2}}}) + {{#ifexpr:{{{6|{{CURRENTDAY}}}}}>={{{3}}}|1|0}} -1 }} month{{#ifeq:{{#expr:{{#ifexpr:{{{5|{{CURRENTMONTH}}}}}<={{{2}}}|12|0}} + ({{{5|{{CURRENTMONTH}}}}}-{{{2}}}) + {{#ifexpr:{{{6|{{CURRENTDAY}}}}}>={{{3}}}|1|0}} -1 }}|1||s}}}}</includeonly><noinclude>{{template doc}}</noinclude>
+
<includeonly>{{#invoke:age/sandbox|age_generic|template=age_ym}}</includeonly><noinclude>{{documentation}}</noinclude>

Revision as of 00:44, 25 June 2016

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

This template returns the duration between two specified dates as a number of full years and remaining months. If the second set of parameters is not included, the duration is between the specified date and today's date.

Syntax

{{age in years and months |year1|month1|day1 |year2|month2|day2}}
{{age in years and months |year1|month1|day1}}  (causing the current date to be used as the second date)

Examples

Markup Renders as
{{age in years and months |1989|7|23 |2003|7|14}}

13 years, 11 months

{{age in years and months |1989|7|23 |1989|8|22}}

0 months

{{age in years and months |1989|7|23 |1989|8|23}}

1 month

{{age in years and months |1989|7|23 |1990|7|23}}

1 year

{{age in years and months |1989|7|23}}

36 years, 3 months

{{age in years and months |1990|7|23 |1989|7|23}}

−1 year

{{age in years and months |1990|9|23 |1989|7|23}}

−1 year, 2 months