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.

Dates uses the Gregorian calendar, without any Julian correction for proleptic Gregorian dates where the calendar was not effectively applied.

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


 * → 22 years, 192 days
 * → 34 years, 350 days
 * → 14 years, 4 days
 * → 34 years, 350 days
 * → 14 years, 4 days
 * → 14 years, 4 days

An error is shown if an entered date is not valid (1800, 1900 and 2100 were not leap years).
 * → Error: Second date should be year, month, day

Dates before the Common Era can use BC or BCE in a single parameter, or astronomical year numbering: 1 BCE is represented by 0, 2 BCE by −1, 3 BCE by −2 etc.
 * (proleptic) →
 * (proleptic) → 1234 years, 266 days

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, 154 days
 * → 23 years, 154 days
 * → 23 years, 154 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" }