Template:Lifespan
(1975–2015)
![]() | This template accepts only year values in date-related parameters; see parameter birth for details, special cases, and exceptions. |
![]() | This template uses Lua: |
This template may be used to display a person's or entity's whole lifespan in years, and optionally their final age or duration, also in years. It is intended for known, definite lifespans, but can handle limited cases of approximate or ambiguous date spans and corresponding age range(s). Presentation and notification options are available. All date-related information must be provided via sources acceptable by Wikipedia.
The implied default calendar is the Gregorian calendar and the editable implied default era is AD/CE; the template may be adapted to other calendars, however such use is not supported programmatically – see MOS:OSNS for special cases where the default calendar (and hence this template) may not be adaptable or appropriate. Presentation is based on Wikipedia's Manual of Style, specifically MOS:YEAR and MOS:YEARRANGE (for date spans) and MOS:ERA (for the age component), with minor exceptions for programming simplicity and ease-of-use.
Usage
[edit]
Listed by relative importance |
Syntax: For basic use, only include the birth- and death-year via parameters |birth=
and |death=
(or in short-form, |b=
and |d=
); numerical years must be entered fully, with all digits.[b]
All parameters are named; some parameters have predefined option sets. Most parameters and some parameter options have short-form aliases. All parameter and option names or aliases must be entered in lowercase.[c]
Copy a blank version from the box above to use. Insert the "|" (pipe) character between each parameter. Delete unused parameters. Unrecognized or undefined parameters are normally ignored; defined parameters do not display without a value.
Date (year) elements: The template presumes Gregorian calendar information; other calendars may be adaptable for use. It renders AD or CE era spans as the implied default; BC or BCE lifespans, and most spans straddling eras, may also be rendered ( ). Year 0 (zero) is allowed,[d] but negative years are not; there is no special handling of astronomical dates.[e]
Age component: The optional age component (the subject's age-at-death or duration, or the related age range) may be auto-calculated and displayed when feasible. The component is set to match the era configuration used by the date span.[f]
Presentation: Output is enclosed in brackets (parentheses) as the editable preset option; depending on the parameters used, other presentation and formatting elements including static text, white space and additional punctuation may be displayed.
Errors and notices: Usage errors and requirement or constraint violations may suppress related template elements and add the edited page to a maintenance category ( ). Depending on the type of parameter(s) involved, notifications may display by default or by user preference. To reduce complexity, rare cases involving certain era-straddling date spans are unhandled exceptions ( ).
Examples
[edit]All examples in this section except "All parameters" use short-form aliases of parameter and option names.
No brackets [info]
{{lifespan |b=1975 |d=2015 |bkt=nb}}
- 1975–2015
Content label [info]
{{lifespan |b=1975 |d=2015 |l=lc}}
- (lifespan: 1975–2015)
Year prefixes [info]
{{lifespan |b=1975 |d=2015 |pfx=tt}}
- (b. 1975 – d. 2015)
Era suffix [info]
{{lifespan |b=1975 |d=2015 |sfx=ad}}
- (1975 –2015 AD)
Era straddle [info]
{{lifespan |b=2015 |d=1975 |sfx=ad |strad=span}}
- (2015 BC – 1975 AD)
Circa birth-year with prefixes [info]
{{lifespan |b=1975 |d=2015 |ca=born |pfx=tt}}
- (b. c. 1975 – d. 2015)
Alternative birth-year with prefixes [info]
{{lifespan |b=1975 |d=2015 |or=born |b2=1980 |pfx=nt}}
- (b. 1975 or 1980 – d. 2015)
Alternative death-year with suffixes [info]
{{lifespan |b=1975 |d=2015 |or=died |d2=2020 |sfx=ad}}
- (1975 AD – 2015 or 2020 AD)
Ambiguous birth-year [info]
{{lifespan |d=2015 |b=uncertain}}
- (uncertain – 2015)
Unknown death-year with prefixes [info]
{{lifespan |b=1975 |pfx=tt |d=unknown}}
- (b. 1975 – d. unknown)
Age component: Age range [info]
{{lifespan |b=1975 |d=2015 |ar=y}}
- (1975–2015, aged 39–40 years)
Age component: Age range with era straddle and age label option [info]
{{lifespan |b=1975 |d=2015 |ar=y |sfx=ad |strad=span |al=dur}}
- (1975 BC – 2015 AD, duration 3989–3990 years)
Age component: Age range with alternative years and prefixes [info]
{{lifespan |b=1975 |d=2015 |ar=y |or=both |b2=2020 |d2=2020 |pfx=nt}}
- (b. 1975 or 2020 – d. 2015 or 2020, aged less than a year to 45 years)
Age component: Age in years (death after birthday) with suffix [info]
{{lifespan |b=2015 |d=1975 |ay=abd |sfx=bc}}
- (2015 –1975 BC, aged 40 years)
Age component: Age in years (death before birthday) with suffix [info]
{{lifespan |b=2015 |d=1975 |ay=bbd |sfx=bc}}
- (2015 –1975 BC, aged 39 years)
All parameters (select conditional parameters excluded programmatically)
{{lifespan |birth=1975 |birth2=1980 |death=2015 |death2=2020 |or=both |ca=both |suffix=ce |strad=span |age-range=y |age-label=nolabel |label=uc |brackets=age |msg=y}}
- Lifespan: c. 1975 or 1980 BCE – c. 2015 or 2020 CE (c. 3994 to 3995 years)
Parameters
[edit]General notes
[edit]With the exception of parameters and options that apply user preferences (e.g. regarding presentation or notifications), all user input must be provided via sources acceptable by Wikipedia (WP:V).
The parameter set consists of 15 native parameters; they apply date information, age information, presentation options and notification options. Parameters may be required, dependent, conditional or default (preset).
Dependent parameters and all parameter options are described under their prerequisites. Non-date parameters are normally ignored when misspelled, when any prerequisite is absent or when inserted without a value. Predefined option sets disallow any other input for the related parameter unless specifically stated otherwise.
Incorrect parameter usage may suppress display of related template elements; see parameter descriptions and § Errors and notifications.
Requirements and constraints
[edit]- Parameters birth (birth-year, alias b) and death (death-year, alias d) are required.
- Parameters birth2 (alternative birth-year, alias b2) and death2 (alternative death-year, alias d2) depend on parameter or (birth and/or death is either of 2 years).
- Parameters birth/b and death/d must be the earliest birth-year and death-year respectively when parameter or is used.
- The year value of parameter birth/b must be earlier than any other date parameter's, but may equal the death-year (parameter death/d).
- The year value of parameter birth2/b2 must be earlier than or equal the alternative death-year (parameter death2/d2).
- The year value of parameter death2/d2 must be later than any other other date parameter's, but may equal the alternative birth-year (parameter birth2/b2).
- When there is an alternative birth-year (parameter birth2/b2) but no alternative death-year (parameter death2/d2), the alternative birth-year must be earlier than or equal the death-year (parameter death/d).
- Parameter strad (date span straddles eras) depends on parameter suffix (era suffix, alias sfx).
- Parameter age-yrs (age in years, alias ay) cannot be used with parameter age-range (range of ages in years, alias ar) or with parameter or.
- Parameter age-label (label for the age component, alias al) requires parameter age-yrs/ay or parameter age-range/ar.
- Parameter label (content label, alias l) cannot be used with parameter prefix (birth/death prefixes, alias pfx).
Parameters and parameter options may have additional specific requirements, constraints and conditions.
Description
[edit]Date spans: Birth- and death-year, alternative birth- and death-year
[edit]- birth, alias b: Required. Enter only the subject's birth, start, or origin year numerically in full decimal notation according to century or millennium. Negative years are not allowed. Year 0 (zero) may be used when applicable.[d] When this parameter is omitted, misspelled or has no value a notification is displayed and all other template output is suppressed.
- Must be chronologically earlier than any other date parameter, but may equal the death-year (parameter death/d).[g]
- When the birth-year is ambiguous or unknown, one of the options below may be used; they are incompatible with parameter ca (circa) when it is applied to the same parameter. They are also incompatible with the age component. May require additional supporting information (WP:V).
- Options:
- Note: Any other input for this parameter produces a notification, see § Errors and notifications and table Error messages: Date parameters.
- death, alias d: Required. Enter only the subject's death, end, or final year as described under parameter birth/b; this parameter has identical requirements and options, but distinct numerical constraints:
- Must be chronologically later than or equal the birth-year (parameter birth/b)
- Must be chronologically earlier than the alternative death-year (parameter death2/d2)
- When there is an alternative birth-year (parameter birth2/b2) but no alternative death-year (parameter death2/d2) the death-year must be chronologically later than or equal the alternative birth-year
- Notifications are displayed otherwise, see examples in table Error messages: Date parameters.
- birth2, alias b2: Optional alternative birth-year. Depends on parameter or, see there under Dependents.
- death2, alias d2: Optional alternative death-year. Depends on parameter or, see there under Dependents.
Approximate dates: "Or" years, "circa" years
[edit]- or: Used for, and required by, the optional alternative birth- and/or death-year. Select a predefined option, any other input is silently ignored; if parameter msg is used, notifications display when in error.
- Options:
- Dependents:
- birth2, alias b2: Alternative birth-year, dependent on, and required when parameter
|or=born
or|or=both
. Enter only a valid year value in full decimal notation according to century or millennium – no other input is allowed. Must be chronologically later than parameter birth/b. When parameter|or=born
, it must be chronologically earlier than or equal parameter death/d; when|or=both
it must be chronologically earlier than or equal parameter death2/d2. Notifications will display when this parameter is in error. - death2, alias d2: Alternative death-year, dependent on and required when parameter
|or=died
or|or=both
. Enter only a valid year value in full decimal notation according to century or millennium – no other input is allowed. Must be chronologically later than all other date parameters; when parameter|or=both
it may equal parameter birth2/b2 [example]. Notifications will display when this parameter is in error.
- birth2, alias b2: Alternative birth-year, dependent on, and required when parameter
- Note: Parameter or is not compatible with, and suppresses age-component parameter age-yrs/ay.
- ca: Use for circa years and the resulting age or range. Inserts the abbreviation/tooltip combination "c." followed by a non-breaking thin space before the relevant year (the tooltip appears only in the first instance of circa, i.e once per transclusion).[h] Requires valid all-numerical year values for parameters birth/b and death/d. Cannot be specified for alternative years. This parameter is passed to the age component when it is included; if parameter age-range/ar is used, circa applies to the entire range regardless of the specific circa-year. Select a predefined option, any other input is silently ignored; if parameter msg is used notifications display when in error.
- Options:
Era suffix
[edit]- suffix, alias sfx: Use to display era suffix(es) preceded by non-breaking thin space, and to implement era-straddling date spans (see parameter strad under Dependents). The implied default era is AD/CE across all dates.[d] There is no specific handling of astronomical dates; the template displays identical date spans for BC/AD and BCE/CE suffixes.[e] Select a predefined option, any other input is silently ignored; if parameter msg is used, notifications display when in error.
- See Note below for an unhandled exception.
- Options:
- Suffix formats:
- No alternative years – singular suffix displays after the date span
- Alternative years – singular suffix displays after both birth and death years [example]
- Era straddle – complementary era suffixes display after both birth and death years [example]
- Dependents:
- strad: Conditional parameter. Set
|strad=span
to display suffixes for date spans that straddle different eras (BC-to-AD or BCE-to-CE) between birth and death years. Requires parameter suffix with any one of the corresponding suffixes [example]
Incorrect values will result in this parameter being silently ignored and the date span rendered according to the underlying era suffix; if parameter msg is used, notifications display when in error.
- strad: Conditional parameter. Set
- Note: Era straddles between birth years or between death years are not handled. For example, the span:
[ 10 BC or 5 AD – 10 AD ]
cannot be rendered by the template.
Age component
[edit]Optional. Requires date parameters with valid, all-numerical year values. Consists of an editable text label and either parameter age-range/ar or age-yrs/ay. When used the subject's final age or age range(s) is auto-calculated and displayed after the date span, or the suffix (if any).[f] Parameter age-label/al may be used to edit the component's label, and preset presentation parameter brackets/bkt may be reset to enclose the component in parentheses; when parameter ca (circa) is used, it is passed to the component.
Autoinserted leading elements: A comma ( , ) and single space, and the text "aged " (the term followed by a non-breaking space) as the component's preset default label. If the brackets are reset around the age component (|brackets=age
) no comma is inserted. The trailing static text " years" (the term preceded by a non-breaking space) is inserted before the closing bracket or as the last visible template element. When any birth-year equals any death-year the static text "less than a year" is displayed instead of the numerical age/range.
- age-range, alias ar: Set
|age-range=y
to display the subject's age range(s). Any other input is silently ignored; if parameter msg is used notifications display when in error. Suppresses parameter age-yrs/ay.
- Range formats:
- No alternative years – the default. Range is two numerical values, the low value signifies the death/end date occurred before the subject's birthday/startday on the death/end year. Values separated by an en dash ( – ) [example]
- Alternative years – range is delimited by the minimum and maximum possible ages defined by the date span(s); they are separated by the static text " to " ("to" surrounded by non-breaking spaces) [example]
- A death/end year equals a birth/start year – the static text "less than a year" is displayed as the minimum range value if there are alternative years, or as the only range value otherwise [example]
- Dependents:
- * age-label, alias al: See Dependents under parameter age-yrs.
- age-yrs, alias ay: Use when the subject's exact or circa age or duration is known. Select the appropriate predefined option, any other input is silently ignored. Cannot be used with parameters age-range/ar and or (and therefore with alternative years). If parameter msg is used notifications display when in error.
- Options:
- Dependents:
- * age-label, alias al: Default parameter for the age component, use to reset or remove the preset label "aged ". Requires one of parameters age-range/ar or age-yrs/ay. Select a predefined option, any other input is silently ignored; if parameter msg is used notifications display when in error.
- Options:
Presentation: Brackets, content label and prefixes
[edit]- brackets, alias bkt: Default parameter, preset to enclose the entire template output in brackets (parentheses) as its first and last visible elements. Predefined options may override or explicitly state the preset, any other input is silently ignored; if parameter msg is used, notifications display when in error.
- Options:
- label, alias l: Use to display the static text "lifespan: " (the term followed by colons and a non-breaking space) as the label for the template's content. Displays immediately after the opening bracket, or first if brackets are removed. Display is suppressed when parameter prefix/pfx is used. Select a predefined option, any other input is silently ignored; if parameter msg is used, notifications display when in error.
- Options:
- prefix, alias pfx: Use to display the abbreviated prefixes "b." (born) and "d." (died) followed by a non-breaking thin space before the birth and death years or before parameter ca (circa). Suppresses parameter label/l. Select a predefined option, any other input is silently ignored; if parameter msg is used, notifications display when in error.
- Options:
Notification handling
[edit]- msg: Optional, intended mainly for testing and debugging purposes. Set
|msg=y
to check for and display notifications about non-date parameters, this parameter included; notifications for unrecognized parameters (including misspellings) will also be displayed. Notifications display first, before any other template output. Any and all such messaging will appear upon transclusion; handling of individual or per-parameter notifications is not supported. Incorrect input for msg will suppress all related notifications except the notification for itself; mislabeling the parameter will additionally suppress its own notification.[j]
Errors and notifications
[edit]The template handles several types of error and maintenance conditions, including fatal errors, usage-related issues, constraint violations and unrecognized parameters. The conditions and/or notifications may suppress display of related template elements; fatal errors stop template application and the notification message suppresses any other template output. Non-fatal notifications display before other output.
Error notifications generated by date parameters (including alternative-year parameters) are always displayed, and the edited page is added to Category:Template Lifespan errors. If either of parameters birth/b and death/d is absent, mislabeled, or has no value the error is fatal.
Unrecognized parameter names, non-date-parameter error conditions, and maintenance issues for any parameter are silent by default; the input error values and in some cases the error/maintenance conditions are ignored. Parameter msg may be used to display any and all related notifications, for affected parameters and generally for any unrecognized or misspelled parameter. When msg itself is in error its message or condition will suppress related notifications.[j]
Notifications are delimited by exclamation marks ( ! ) and are grouped and numbered according to context; the numbering may not be strictly sequential. Error messages display mostly in red text, other notices in gray text.
No. | Type | Message | Link |
---|---|---|---|
F01 | [fatal error] | ! Parameter birth/b is missing, mislabeled, or has no value ! | [info] |
F02 | [fatal error] | ! Parameter death/d is missing, mislabeled, or has no value ! | [info] |
E11 | [usage error] | ! Birth-year has invalid value ! | [info] |
E12 | [usage error] | ! Death-year has invalid value ! | [info] |
E13 | [constraint] | ! Birth-year must be earlier than or equal the death-year ! | [info] |
E14 | [constraint] | ! Birth-year must be earlier than the alternative birth-year ! | [info] |
E15 | [constraint] | ! Death-year must be earlier than the alternative death-year ! | [info] |
E16 | [constraint] | ! Birth-year must be earlier than the alternative death-year ! | [info] |
E21 | [usage error] | ! Parameter birth2/b2 is missing, mislabeled or has no value ! | [info] |
E22 | [usage error] | ! Parameter death2/d2 is missing, mislabeled or has no value ! | [info] |
E23 | [usage error] | ! Alternative birth-year has invalid value ! | [info] |
E24 | [usage error] | ! Alternative death-year has invalid value ! | [info] |
E25 | [constraint] | ! Alternative birth-year requires parameter or ! | [info] |
E26 | [constraint] | ! Alternative death-year requires parameter or ! | [info] |
E27 | [constraint] | ! When there is no alternative death-year, the alternative birth-year must be earlier than or equal the death-year ! | [info] |
E28 | [constraint] | ! Alternative birth-year must be earlier than or equal the alternative death-year ! | [info] |
No. | Type | Message | Link |
---|---|---|---|
E31 | [usage error] | ! Invalid brackets option value ! | [info] |
E32 | [usage error] | ! Invalid content label option value ! | [info] |
E33 | [constraint] | ! Content label cannot be used when prefixes are used ! | [info] |
E34 | [usage error] | ! Invalid prefix option value ! | [info] |
E35 | [usage error] | ! Invalid circa option value ! | [info] |
E36 | [constraint] | ! Circa year(s) require all-numerical value(s) ! | [info] |
E41 | [usage error] | ! Parameter or invalid option value ! | [info] |
E51 | [usage error] | ! Invalid suffix option value ! | [info] |
E52 | [usage error] | ! Year 0 (zero) may only have the suffix option "ce" ! | [info] |
E53 | [constraint] | ! Era straddle requires a suffix ! | [info] |
E54 | [usage error] | ! Invalid era straddle value ! | [info] |
E60 | [constraint] | ! Age component requires all-numerical year values ! | [info] |
E61 | [usage error] | ! Invalid age range value ! | [info] |
E62 | [usage error] | ! Invalid age option value ! | [info] |
E63 | [usage error] | ! Invalid age label option value ! | [info] |
E64 | [constraint] | ! The age cannot be rendered when alternative years are used ! | [info] |
E65 | [constraint] | ! The age cannot be rendered when the age range is used ! | [info] |
E66 | [constraint] | ! Age label requires the age or range ! | [info] |
E101 | [usage error] | ! Parameter msg invalid value ! | [info] |
No. | Type | Notice | Link |
---|---|---|---|
N01 | [usage] | ! Unrecognized parameter name <parameter name> ! | [info] |
N02 | [maintenance] | ! Year 0 (zero) without explicit suffix option "ce" (CE implied) ! | [info] |
N03 | [maintenance] | ! Superfluous alternative year ! | [info] |
TemplateData
[edit]TemplateData for Lifespan
This template may be used to display (within removable parentheses) a person's or entity's whole lifespan in years, and optionally their final age or duration, also in years; the Gregorian calendar and AD/CE era are respectively, the implied default calendar and editable default era. Other calendars, and astronomical dates, may be adapted to the template. Negative years are not allowed. Year 0 (zero) may be used when applicable. All date-related input must be provided by acceptable sources. When entered manually, all predefined options must be in lowercase, without quote-marks. For details and examples see the template's documentation. Parameter list order reflects relative importance
Parameter | Description | Type | Status | |
---|---|---|---|---|
Birth/Start | birth b | The birth/start/origin year. Enter only the full year, numerically with all digits according to century or millennium; for ambiguous or unknown birth years select one of the dropdown list options
| String | required |
Death/End | death d | The death/end/final year. Enter only the full year, numerically with all digits according to century or millennium; for ambiguous or unknown death years select one of the dropdown list options
| String | required |
Or | or | Required when using alternative birth and/or death years. Not compatible with 'Age (years)'. Must enter (in lowercase, no quote-marks) or select from the dropdown list the option matching the alternative year(s)
| String | optional |
Alternative birth/start | birth2 b2 | Alternative birth-year. Requires parameter 'Or' with option 'born' or 'all'; must be chronologically later than 'Birth/Start'; when there is no alternative death-year it must be chronologically earlier or equal to 'Death/End'. Enter only the full year numerically with all digits according to century or millennium | Date | optional |
Alternative death/end | death2 d2 | Alternative death-year. Requires parameter 'Or' with option 'died' or 'all'; must be chronologically later than 'Death/End'. Enter only the full year numerically with all digits according to century or millennium | Date | optional |
Era suffix | suffix sfx | Displays any of AD/BC/BCE/CE suffixes after the date span; when there are alternative years or era straddles suffixes display after both birth and death years. Required by 'Era straddle'. Select the relevant option from the dropdown list or type-in (lowercase, no quote-marks). Implied default is AD/CE. Notations BC/AD and BCE/CE are functionally identical
| String | optional |
Era straddle | strad | Use when the date span straddles different eras (BC-to-AD or BCE-to-CE); displays the complementary suffixes after the birth and death years. Requires 'Era suffix'. Select or type-in 'span' (lowercase, no quote-marks)
| String | optional |
Circa | ca | Use for circa birth and/or death years; passed to the age/range if present. Requires numerical year values; enter (in lowercase, no quote-marks) or select from the dropdown list the option matching the circa year(s)
| String | optional |
Prefixes | prefix pfx | Displays the abbreviated prefixes 'b.' and 'd.' before the birth and death years; suppresses 'Content label'. Enter (in lowercase, no quote-marks) or select from the dropdown list option 'tt' to add hovering tooltip text, 'nt' for plain text (no tooltips)
| String | optional |
Age (years) | age-yrs ay | Auto-calculates and displays the subject's exact or circa age. Requires numerical year values. Cannot be used with 'Or' or 'Age (range)'. Enter (in lowercase, no quote-marks) or select from the dropdown list option 'abd' if the death/end occured after the birthday/startday on the death year, 'bbd' otherwise
| String | optional |
Age (range) | age-range ar | Set to 'y' (lowercase, no quote-marks) to display the subject's possible age range(s). Requires numerical year values. Cannot be used with 'Age (years)'
| Boolean | optional |
Age label | age-label al | Label before the age or range, requires either 'Age (years)' or 'Age (range)'. Preset default is 'aged'; enter (in lowercase, no quote-marks) or select from the dropdown list an option to reset ('nolabel' removes the age label)
| String | optional |
Content label | label l | Displays 'lifespan: ' as label for the template content; will not display when 'Prefixes' is used. Enter (in lowercase, no quote-marks) or select from the dropdown list option 'lc' for all-lowercase label, 'uc' for initial-letter uppercase
| String | optional |
Brackets | brackets bkt | Parentheses, enclose the full output by default (preset to 'full'). To display brackets around the age/range only, enter 'age' (in lowercase, no quote-marks) or select it from the dropdown list; 'nb' removes brackets altogether
| String | optional |
Notification display | msg | Set to 'y' (lowercase, no quote-marks) to display all notifications related to non-date parameters; may suppress display of related template elements; use to test template output during preview
| Boolean | optional |
Footnotes
[edit]- ^ Rudimentary description of the template's logic may be found in Template talk:Lifespan § Logic.
- ^ Template
{{YEAR}}
is used to apply numerical year value conformance. - ^ Temporary or place-holding parameters are not bound by the naming requirements and may be undocumented.
- ^ a b c Year 0 (zero) does not exist in BC/AD eras and should be used with the CE suffix only (this suffix is implied and its explicit use is optional). If the optional error checking is on, invalid suffixes will generate an error message; no suffix will result in a maintenance notice.
- ^ a b Common Era (BCE/CE) suffixes may be used to adapt astronomical date numbering to the template (substituting negative years, which return an error).
- ^ a b Template
{{age}}
is used to calculate ages and range(s). - ^ When the subject's final age or duration is less than a year.
- ^ Template
{{circa}}
is used to display circa years. - ^ Template
{{abbr}}
is used to display tooltips. - ^ a b When the edited page contains a large number of {{lifespan}} transclusions with
|msg=y
, a small performance cost may be incurred.