Template:Age in years and days/doc
Sarna News
- HEXTECH Review - Wave 3 Brings More Urban Options To Your Battlefield
- Your BattleTech News Round-Up For March, 2024
- Crashing 'Mechs With Jennifer Brozek, Author Of The Rogue Academy Trilogy
- Getting The Word Out With Rem Alternis, Catalyst Community & Marketing Director
- Bad 'Mechs - Yeoman
- Read more →
This is a documentation subpage for Template:Age in years and days. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
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.
This template does not generate a sort key. In a sortable table, use {{ayd}} which redirects to {{age in years and days nts}}.
Usage[edit]
Each date can be entered in a single parameter, or each date can be entered as three parameters: year, month, day.
{{age in years and days|15 May 2010}}
→ 13 years, 340 days{{age in years and days|12 Aug 2003|24 Sep 2011}}
→ 8 years, 43 days{{age in years and days|1989|7|23}}
→ 34 years, 271 days{{age in years and days|1989|7|23|2003|7|24}}
→ 14 years, 1 day{{age in years and days|2007-03-02|2008-03-02}}
→ 1 year, 0 days{{age in years and days|1999-11-07|2112-02-15}}
→ 112 years, 100 days
An error is shown if an entered date is not valid (1800, 1900 and 2100 were not leap years).
{{age in years and days|31 January 1892|29 February 1900}}
→ Error: Second date should be year, month, day
Options[edit]
The default is to separate years and days with a comma. The separator is "and" if |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 |duration=on
is used.
{{age in years and days|1 Jan 2011|31 Dec 2012}}
→ 1 year, 365 days{{age in years and days|1 Jan 2011|31 Dec 2012|sep=and}}
→ 1 year and 365 days{{age in years and days|1 Jan 2011|31 Dec 2012|duration=on}}
→ 2 years, 0 days
TemplateData[edit]
Unexpected property "params.sep.suggestedvalues".