Dev Wiki:Sandbox/Global Lua Modules/Age

Templates supported
Module:Age implements the following templates:

Redirects

The age templates expect the older date to be first. The implementations of  and   display an error message if that is not the case. If similar checking is wanted for other templates,  can be added to the invoke. For example, age might use: If  does not apply, a negative difference is indicated with a minus sign (−).

Date formats
Dates can use numbered or named parameters to specify year/month/day. Alternatively, a full date can be entered in a variety of formats. For example:
 * → 11 years, 1 month
 * → 22 years, 9 months
 * → 24 years, 7 months
 * → 22 years, 9 months
 * → 24 years, 7 months
 * → 24 years, 7 months

If the first or second date is omitted, the current date is used. For example:
 * → 24 years, 7 months
 * → 12 years, 1 month
 * → 12 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 23 years, 6 months
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months

Parameters
The following options are available:

Examples using the  parameter follow.
 * → 11 years, 1 month
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months
 * → 24 years, 7 months

The sort key is based on the age in days, and fractions of a day if a time is specified.
 * → 22 years, 9 months
 * → 22 years, 10 months

An extra day is added for a duration.

The least-significant time unit can be rounded.

Large numbers can be formatted with commas.

Spelling numbers
The templates that use  can display numbers in words rather than using numerals. The result can be a cardinal number (such as "five") or an ordinal number (such as "fifth"). The first letter can be in uppercase, and US spelling of numbers can be used. Examples:
 * → 120
 * → 120
 * → 120
 * → 120
 * → 120
 * → 120
 * → 120
 * → 120
 * → 0
 * → 5 years, 1 day