Template:Age in years and days/doc

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 Template:Ayd which redirects to 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.


 * → 22 years, 220 days
 * → 35 years, 13 days
 * → 14 years, 4 days
 * → 14 years, 4 days

An error is shown if an entered date is not valid (1900 was not a leap year).
 * → Error: Second date should be year, month, day

Options
The default is to separate years and days with a comma. The separator is "and" if 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 on is used.


 * → 23 years, 182 days
 * → 23 years, 182 days
 * → 23 years, 182 days

TemplateData
{	"params": { "1": {			"label": "Earlier date", "description": "The earlier date being compared", "type": "date", "required": true },		"2": {			"label": "Later date", "description": "The later date being compared", "type": "date", "default": "Today's date", "suggested": true },		"sep": { "label": "Separator", "description": "Defines a custom separator between the years and days", "type": "string", "suggestedvalues": [ "and" ],			"default": "," },		"duration": { "label": "Duration?", "description": "Set to \"on\" to include the second date in the calculation; will return a result one higher than if left off", "type": "boolean" }	},	"description": "Returns the number of full years and surplus days between two specified dates (or, if only one date is entered, between the specified date and today's date)", "paramOrder": [ "1",		"2",		"sep", "duration" ],	"format": "inline" }