Changes

Jump to navigation Jump to search
add {{Lua|Module:Age}}, misc formattin
{{Documentation subpage}}
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Lua|Module:Age}}

This template returns the number of full years and surplus days between two specified dates. If only one date is entered, the template returns the number of full years and surplus days between the specified date and today's date.

This template does not generate a sort key. In a [[Help:Sorting|sortable table]], use {{no redirect|Template:Ayd|<nowiki>{{ayd}}</nowiki>}} which redirects to {{tl|age in years and days nts}}.

== Usage ==
Each date can be entered in a single parameter, or each date can be entered as three parameters: year, month, day.

* <code><nowiki>{{age in years and days|15 May 2010}}</nowiki></code> → {{age in years and days|15 May 2010}}
* <code><nowiki>{{age in years and days|12 Aug 2003|24 Sep 2011}}</nowiki></code> → {{age in years and days|12 Aug 2003|24 Sep 2011}}
* <code><nowiki>{{age in years and days|1989|7|23}}</nowiki></code> → {{age in years and days|1989|7|23}}
* <code><nowiki>{{age in years and days|1989|7|23|2003|7|24}}</nowiki></code> → {{age in years and days|1989|7|23|2003|7|24}}
* <code><nowiki>{{age in years and days|2007|03|02|2008|03|02}}</nowiki></code> → {{age in years and days|2007|03|02|2008|03|02}}

An error is shown if an entered date is not valid (1900 was not a leap year).<!--fixed wikitext to avoid tracking category-->
* <code><nowiki>{{age in years and days|31 January 1892|29 February 1900}}</nowiki></code> → <span id="FormattingError"></span><strong class="error">Error: Second date should be year, month, day</strong>

== Options ==
The default is to separate years and days with a comma. The separator is "and" if {{para|sep|and}} is used.

The default calculates an age—the day of the second date is not included in the calculation. A duration including the second date is calculated if {{para|duration|on}} is used.

* <code><nowiki>{{age in years and days|1 Jan 2011|31 Dec 2012}}</nowiki></code> → {{age in years and days|1 Jan 2011|31 Dec 2012}}
* <code><nowiki>{{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}}</nowiki></code> → {{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}}
* <code><nowiki>{{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}}</nowiki></code> → {{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}}

{{Birth, death and age templates|age}}

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Date mathematics templates]]

}}</includeonly>
Anonymous user

Navigation menu