Difference between revisions of "Template:Age in years and days nts/doc"
blackwiki>Johnuniq (show {{ayd}} as redirect and some examples) |
m (4 revisions imported) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{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 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. | ||
Line 10: | Line 12: | ||
For convenience, the redirect {{{{no redirect|Template:Ayd|ayd}}}} can be used. Each date can be entered in a single parameter, or each date can be entered as three parameters (year, month, day). | For convenience, the redirect {{{{no redirect|Template:Ayd|ayd}}}} can be used. Each date can be entered in a single parameter, or each date can be entered as three parameters (year, month, day). | ||
− | *<code><nowiki>{{ayd|15 May 2010}}</nowiki></code> → {{ayd|15 May 2010}} | + | * <code><nowiki>{{ayd|15 May 2010}}</nowiki></code> → {{ayd|15 May 2010}} |
− | *<code><nowiki>{{ayd|12 Aug 2003|24 Sep 2011}}</nowiki></code> → {{ayd|12 Aug 2003|24 Sep 2011}} | + | * <code><nowiki>{{ayd|12 Aug 2003|24 Sep 2011}}</nowiki></code> → {{ayd|12 Aug 2003|24 Sep 2011}} |
− | *<code><nowiki>{{ayd|1989|7|23}}</nowiki></code> → {{ayd|1989|7|23}} | + | * <code><nowiki>{{ayd|1989|7|23}}</nowiki></code> → {{ayd|1989|7|23}} |
− | *<code><nowiki>{{ayd|1989|7|23|2003|7|24}}</nowiki></code> → {{ayd|1989|7|23|2003|7|24}} | + | * <code><nowiki>{{ayd|1989|7|23|2003|7|24}}</nowiki></code> → {{ayd|1989|7|23|2003|7|24}} |
− | *<code><nowiki>{{ayd|2007|03|02|2008|03|02}}</nowiki></code> → {{ayd|2007|03|02|2008|03|02}} | + | * <code><nowiki>{{ayd|2007|03|02|2008|03|02}}</nowiki></code> → {{ayd|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--> | 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>{{ayd|31 January 1892|29 February 1900}}</nowiki></code> → <span id="FormattingError"></span><strong class="error">Error: Second date should be year, month, day</strong> | + | * <code><nowiki>{{ayd|31 January 1892|29 February 1900}}</nowiki></code> → <span id="FormattingError"></span><strong class="error">Error: Second date should be year, month, day</strong> |
+ | |||
+ | {{Birth, death and age templates|age}} | ||
− | |||
<includeonly>{{sandbox other|| | <includeonly>{{sandbox other|| | ||
<!-- Categories below this line, please; interwikis at Wikidata --> | <!-- Categories below this line, please; interwikis at Wikidata --> | ||
[[Category:Date mathematics templates]] | [[Category:Date mathematics templates]] | ||
}}</includeonly> | }}</includeonly> |
Latest revision as of 12:38, 18 October 2020
![]() | This is a documentation subpage for Template:Age in years and days nts. It contains usage information, categories and other content that is not part of the original template page. |
![]() | This template uses Lua: |
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.
A hidden sort key is included so values produced by this template will work properly in sortable tables. The sort key is calculated from the number of days between the given dates, and is compatible with {{number table sorting}}.
This is temporary documentation resulting from Template talk:Age in years and days#Google problems which shows problems when {{age in years and days}} outputs a hidden sort key. It is proposed that {{age in years and days}} will not output a hidden sort key, so {{age in years and days nts}} is needed for when a sort key is wanted.
Usage
For convenience, the redirect {{ayd}} can be used. Each date can be entered in a single parameter, or each date can be entered as three parameters (year, month, day).
{{ayd|15 May 2010}}
→ 15 years, 114 days{{ayd|12 Aug 2003|24 Sep 2011}}
→ 8 years, 43 days{{ayd|1989|7|23}}
→ 36 years, 45 days{{ayd|1989|7|23|2003|7|24}}
→ 14 years, 1 day{{ayd|2007|03|02|2008|03|02}}
→ 1 year, 0 days
An error is shown if an entered date is not valid (1900 was not a leap year).
{{ayd|31 January 1892|29 February 1900}}
→ Error: Second date should be year, month, day