Template:Lifespan
(1975–2015)
This documentation is a work-in-progress. |
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 primarily intended for known, definite lifespans, but can also handle limited cases of approximate or ambiguous date spans, and the corresponding age range(s). All information should be provided by acceptable sources. Additional options affect presentation, and error messaging is available for several usage errors.
Presentation follows 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. The implied default calendar is the Gregorian calendar; although the template may be adapted to other calendars, such use is not supported programmatically. See MOS:OSNS for special cases where the default calendar (and hence this template) may or may not be adaptable or appropriate.
Usage
Listed by importance |
Option summary
Syntax and presentation
For basic use, only the birth- and death-years (via parameters |birth=
and |death=
) are required; the years must be entered fully, with all digits.
The template handles Gregorian calendar information, rendering AD/CE era spans as the implied default; BC/BCE lifespans and most spans straddling eras may also be rendered ( ). There is no special handling for astronomical dates.
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.
Output is enclosed in brackets (parentheses) as the editable default; depending on the parameters used, other default presentation and formatting elements including static text, white space and additional punctuation may be displayed.
The template employs required, dependent, and conditional parameters. All parameters are named; most parameters and parameter options have short-form aliases. Parameter names and aliases must be entered in lowercase. Non-date (non-year) optional parameters are ignored when they are misspelled or unrecognized; they are also ignored when any prerequisite parameters or conditions are absent.
Usage errors may suppress related template elements and may add the edited page to a maintenance category ( ). Error messages may display by default or depending on parameter type and user preference. To reduce complexity, some cases involving certain era-straddling or ambiguous date spans (and age ranges) remain unhandled exceptions ( ).
Copy a blank version from the box above to use. Insert the "|" (pipe) character between each parameter. Delete unused parameters.
Examples
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 prefix [info]
{{lifespan |b=1975 |d=2015 |pfx=y}}
- (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=b-a}}
- (2015 BC – 1975 AD)
Circa birth-year [info]
{{lifespan |b=1975 |d=2015 |pfx=y |sfx=ad |ca=born}}
- (b. c. 1975 – d. 2015 AD)
Alternative birth-year [info]
{{lifespan |pfx=y |b=1975 |d=2015 |or=born |b2=1980}}
- (b. 1975 or 1980 – d. 2015)
Alternative death-year [info]
{{lifespan |pfx=y |b=1975 |d=2015 |or=died |d2=2020}}
- (b. 1975 – d. 2015 or 2020)
Ambiguous birth-year [info]
{{lifespan |d=2015 |b=uncertain}}
- (uncertain – 2015)
Unknown death-year [info]
{{lifespan |b=1975 |pfx=y |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 label [info]
{{lifespan |b=1975|d=1975 |al=dur |ar=y}}
- (1975–1975, duration less than a year)
Age component: age in years (death after birthday) [info]
{{lifespan |b=2015 |d=1975 |sfx=bc |ay=abd}}
- (2015–1975 BC, aged 40 years)
Age component: age in years (death before birthday) [info]
{{lifespan |b=2015 |d=1975 |sfx=bc |ay=bbd}}
- (2015–1975 BC, aged 39 years)
Complex edge-case involving ranges [info]
{{lifespan |b=1975 |d=2015 |or=both |b2=2020 |d2=2020 |pfx=y |ar=y}}
- (b. 1975 or 2020 – d. 2015 or 2020, aged less than a year to 45 years)
Complex example with all non-mutually exclusive parameters
{{lifespan |birth=1975 |birth2=1980 |death=2015 |death2=2020 |or=both |ca=both |suffix=ce |age-label=aged |age-range=y |label=uc |brackets=age |err=y }}
- Lifespan: c. 1975 or 1980 – c. 2015 or 2020 CE (aged c. 34 to 45 years)
Parameters
General notes
Dependent parameters and parameter options are described under their prerequisites. Parameter options must be entered in lowercase.
Incorrect usage of some parameters may suppress display of related template elements; see parameter descriptions below, and § Errors and error messages.
Requirements and constraints
- Parameters birth (or its alias b) and death (or its alias d) are required.
- Parameters label (content label, alias l) and prefix (birth/death prefixes, alias pfx) should not be used concurrently.
- 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 and death must be the earliest birth-year and death-year respectively when parameter or is used.
- Parameter's birth year value must be earlier than any other date parameter's, but may be equal to the death-year (parameter death).
- Parameter's birth2 year value must be earlier or equal to the alternative death-year (parameter death2).
- Parameter's death2 year value must be later than any other other date parameter's, but may be equal to the alternative birth-year (parameter birth2).
- Parameter age-yrs (age in years, alias ay) cannot be used with parameter age-range (range of ages in years, alias ar), and also cannot be used with parameter or.
- Parameter age-label (label for the age component, alias al) requires parameter age-yrs or parameter age-range.
Parameters and parameter options may have additional specific requirements, constraints and conditions.
Description
Date spans: birth- and death-year, alternative birth- and death-year
- birth, alias b: Required. Enter the subject's birth, start, or origin year numerically in full decimal notation according to century or millennium. When this parameter is omitted or misspelled an error message will be displayed and all other template output will be suppressed; [example]
- Its year value must be chronologically earlier than the year value of any other date parameter, however it may equal a death-year;[a] relevant error messages will display otherwise.
- Options: Provided for convenience, the options below are not compatible with parameter ca (circa) when applied to the same date parameter; also not compatible with the age component. May require additional supporting information (WP:V).
|birth=uncertain
– may be used when the birth-year is disputed, is one of three or more years proposed in acceptable sources, is not yet determined, or is estimated within a period longer than circa; [example]|birth=unknown
– may be used when the birth-year is unknown or cannot be determined; [example]
- Note: Any other input for this parameter will produce an error message, see § Errors and error messages.
- death, alias d: Required. Enter the subject's death, end, or final year as described under parameter birth above; this parameter has identical requirements and options, but distinct numerical constraints. Its year value must be equal to or chronologically later than the birth-year (parameter birth) and also, chronologically earlier than the alternative death-year (see parameters or and death2); relevant error messages will display otherwise, see examples under § Errors and error messages.
- birth2, alias b2: Optional alternative birth-year. Depends on parameter or, see there under Dependents.
- death2, alias d2: Optional alternative death-year, see above.
Approximate dates: "or" years, "circa" years
- or: Used for, and required by, the optional alternative birth- and/or death-year ( ). Select one of the options below; non-valid input is silently ignored. If error-handling parameter err is used, relevant error messages will be displayed when in error; [example]
- Options:
- Dependents:
- birth2, alias b2: Alternative birth-year, dependent on, and required when parameter
|or=born
or|or=both
. Enter number in full decimal notation according to century or millennium – no other input is allowed. Its year value must be chronologically later than parameter's birth/b; when parameter|or=both
it must be chronologically earlier or equal to parameter's death2. When in error, relevant messages will display; [example] - death2, alias d2: Alternative death-year, dependent on and required when parameter
|or=died
or|or=both
. Enter number in full decimal notation according to century or millennium – no other input is allowed. Its year value must be chronologically later than that of all other date parameters; when parameter|or=both
it may be equal to parameter's birth2. When in error, relevant messages will display.
- birth2, alias b2: Alternative birth-year, dependent on, and required when parameter
- Note: or is not compatible with, and will suppress age-component parameter age-yrs; [example]
- ca: Use for circa dates (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 link will appear only in the first instance of the abbreviation). Requires year values for the birth and death parameters. Cannot be specified for alternative years. This parameter is passed to the age component when it is included; if parameter age-range is used, circa applies to the entire range regardless of the specific circa-year. Select one of the options below; non-valid input is silently ignored. If error-handling parameter err is used a message will be displayed when in error.
- Options:
|ca=born
– set for circa birth-year(s); [example]|ca=died
– set for circa death-year(s).|ca=both
– when both circa birth-year(s) and circa death-year(s) are used.
Era suffix
- suffix, alias sfx: Use to display an era suffix, preceded by a thin space, after the date span (i.e. after the last death-year) or, when the span straddles eras, after the birth- and death- year(s) separately. The implied default era is AD/CE across all dates. As there is no handling of astronomical dates BC/AD suffixes and BCE/CE suffixes display identical date spans. See Note below for an unhandled exception.
- Options:
|suffix=ad
or|suffix=ce
– set to explicitly state the default date span era as "AD" or "CE"; [example]|suffix=bc
or|suffix=bce
– set to display the date span era as "BC" or "BCE".|suffix=b-a
– set when the date span straddles eras and the BC/AD notation is used. The birth-year(s) will be followed by the suffix "BC"; death-year(s) will be followed by suffix "AD"; [example]|suffix=b-c
– set when the date span straddles eras and the BCE/CE notation is used. The birth-year(s) will be followed by the suffix "BCE"; death-year(s) will be followed by suffix "CE".
- 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.
The age component
Optional, requires all date parameters to have numerical year values. When used the subject's final age or age range(s) will be auto-calculated, and displayed after the date span (or the suffix if any).[b] Also inserted as preceding elements: A comma ( , ) and space, and the editable default static text "aged" as the age component's label; if the brackets are set around only the age component (|brackets=age
) no comma is inserted. The trailing static text "years" is also inserted before the closing bracket or as the last visible template element. When any birth-year is the same as a death-year, the static text "less than a year" will be displayed instead of the numerical age/range boundary. The component does not normally handle or display "0" (zero) years; astronomical dates are not supported. In certain cases the age result may be ambiguous, undefinable, or impossible, see Note below.
- age-label, alias al: Label for the age component. Requires one of parameters age-range or age-yrs. Any or none of the options below may be selected; non-valid input is silently ignored. If error-handling parameter err is used relevant messages will be displayed when in error.
- Options:
- age-range, alias ar: Set
|age-range=y
to display the subject's age range(s) – any other input will be ignored, or will produce an error message if error-handling parameter err is used. This parameter and parameter age-yrs are mutually exclusive; [example]
- Variations:
- When there is no suffix or there is a singular suffix (AD/CE or BC/BCE), and no alternative years, the age range is two numerical values (death/end may be either before or after birthday/startday) separated by an en dash ( – ); [example]
- When there is no suffix or there is a singular suffix and alternative years, the range is bounded by the minimum and maximum possible ages as defined by the date spans; the range's age boundaries are separated by the static text "to" surrounded by non-wrapping spaces; [example]
- The static text "less than a year" will be displayed as the minimum range value when alternative years are included and any death/end year is the same as any birth/start year (subject to date parameter constraints); when there are no alternative years the text will display as the only range value; [example]
- Note: When the date span(s) have suffixes that straddle eras (BC-to-AD or BCE-to-CE) and parameter
|or=both
, the range may not be correctly rendered. For example, the lifespans below fail both the range calculation and the constraints of date parameters:{{lifespan|b=10|d=5|or=both|b2=15|d2=15|sfx=b-a|ar=y}}
(10 or 15 BC – 5 or 15 AD, aged less than a year to −4 years){{lifespan|b=10|d=5|or=both|b2=15|d2=20|sfx=b-a|ar=y}}
(10 or 15 BC – 5 or 20 AD, aged −5 to −9 years)
- age-yrs, alias ay: Use when the subject's exact or circa age is known. Select one of the options below; any other input will be ignored, or will produce an error message if error-handling parameter err is used. Cannot be used with parameter or. This parameter and parameter age-range are mutually exclusive; [example]
- Options:
Presentation: brackets, label and prefix
- brackets, alias bkt: Brackets (parentheses) enclose the entire template output by default, as the first and last visible elements. Options below may either override or explicitly state the default; any other input will be silently ignored.
- Options:
- label, alias l: Use to display the static text "lifespan: " (the term followed by colons and a space) as the label for the template's content. When included, it will normally display immediately after the opening bracket or first if brackets are removed. This parameter is silently ignored when parameter prefix is used; non-valid input is also silently ignored. If error-handling parameter err is used, relevant messages will be displayed when in error; [example]
- Options:
- prefix, alias pfx: Set
|prefix=y
to display the abbreviated prefix/tooltip combinations "b." and "d." followed by a non-breaking thin space before the birth- and death-year respectively (or before the parameter {{bxtncirca}} when used). Any other input for this parameter will be silently ignored, while its inclusion will suppress parameter label; if error-handling parameter err is used, relevant error messages will be displayed; [example]
Error message handling
- err: Set
|err=y
(any other input will generate an error message) to display all error messages produced by non-date optional-parameter errors, including this parameter. Intended mainly for testing and debugging purposes.[c] Handling of individual or per-parameter errors is not supported. Depending on the parameter(s) in error, using err may cause the relevant error message(s) to display before any other template output. See also § Errors and error messages.
Errors and error messages
Error messages generated by date parameter errors (including alternative year parameter errors) are always displayed, and the edited page is added to Category:Template Lifespan errors. If either of parameters birth and death is absent, mislabeled, or empty the error is fatal and will suppress all other template output.
Errors related to non-date (non-year) optional parameters are silent by default; parameter err may be used to display error messages for all such parameters including err itself.[c]
Error conditions and/or error messages may suppress display of related template elements.
There is no error handling for individual, non-date optional parameters; error messages display for all message-enabled optional parameters, or none.
Examples – date parameters[d]
Missing death-year [info]
{{lifespan |b=1975}}
Birth-year later than death-year (AD/CE) [info]
{{lifespan |b=2015 |d=1975}}
Birth-year later than death-year (BC/BCE) [info]
{{lifespan |b=1975 |d=2015 |sfx=bc}}
Birth-year later than alternative birth-year [info]
{{lifespan |b=1976 |b2=1975 |d=2015 |or=born}}
Missing alternative birth-year [info]
{{lifespan |b=1975 |d=2015 |or=born}}
Alternative year(s) require parameter or [info]
{{lifespan |b=1975 |b2=1985 |d=2015 |d2=2020}}
Examples – non-date parameters, error messages on
Parameter suffix: Non-valid input [info]
{{lifespan |b=1975 |d=2015 |sfx=none |err=y}}
Parameter label not compatible with parameter prefix [info]
{{lifespan |b=1975 |d=2015 |pfx=y |l=lc |err=y}}
Age component: Non-valid input for parameter age-range [info]
{{lifespan |b=1975 |d=2015 |ar=full |err=y}}
Age component: Parameter age-yrs not compatible with parameters or and age-range [info]
{{lifespan |b=2015 |d=1975 |b2=2016 |pfx=y |sfx=b-a |or=born |ay=bbd |ar=y |err=y}}
Footnotes
- ^ When the subject's final age or duration is less than a year.
- ^ Template
{{age}}
is used to calculate ages and range(s). - ^ a b When the edited page contains a large number of {{lifespan}} transclusions with
|err=y
, a small performance cost may be incurred. - ^ Categories are suppressed in examples that would otherwise categorize this page.