Template:Birth-date and age
Jump to navigation
Jump to search
Lua-based templates
Pages with script errors
Templates generating microformat date and age
Templates that add a tracking category
Templates tracking Wikidata
Test cases using output parameter
Home > Wiki > MediaWiki > MediaWiki websites > Wikipedia.org website > Wikipedia administration > Wikipedia templates > Wikipedia utility templates > Time, date and calendar templates > Date mathematics templates
This template is used on approximately 11,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Transclusion count updated by Ahechtbot. |
This template tracks the Wikidata property: Lua error in Module:Uses_Wikidata at line 13: attempt to index field 'wikibase' (a nil value). |
This template uses Lua: |
{{Birth-date and age}} displays a person’s birth date and age. Besides calculating the age of the person, the benefit of using this template is to allow for the inclusion of hidden microformat dates, which may be indexed or searched by software tools.
Note: The template may not calculate the age correctly if a full date (month, day, year) is not provided. For example, a person who was born in 1941 could be either 83 or 84, depending on whether they have reached their birthday in the current year:
{{Birth-date and age|1941}}
→ Template:Birth-date (age 84){{Birth-date and age|February 1941}}
→ Template:Birth-date (age 84)
When only the year is known, consider using {{Birth year and age}} instead:
{{Birth year and age|1941}}
→ Template:Birth year and age{{Birth year and age|1941|2}}
→ Template:Birth year and age
Usage
- Format
{{Birth-date and age| birth date }}
{{Birth-date and age| birth date | wikitext to display in place of 'birth date'. Like the right hand parameter in a wikilink, this could be alternate text, links, templates etc. }}
Examples
Month first format: Sample below displays Template:Birth-date (age 83), with invisible microformat date: 1941-04-12
|
Day first format: Sample below displays Template:Birth-date (age 83), with invisible microformat date: 1941-04-12
|
Year only, year and month only: Sample below displays Template:Birth-date (age 84), with invisible microformat date: 1941
|
Demo of ISO date, as well as alternate displays. Sample below displays Template:Birth-date (age 83), with invisible microformat date: 1941-04-12
|
Microformat output
Birth date and age templates:
{{Birth-date and age|31 December 2016}}
→ Template:Birth-date (age 8)[[:Template:Birth-date]] (age <span class="currentage"></span>8)
{{Birth date and age|2016|12|31|df=y}}
→ 31 December 2016<span style="display:none"> (<span class="bday">2016-12-31</span>) </span>31 December 2016<span class="noprint ForceAgeToShow"> (age 8)</span>
Parameters
{{birth-date and age|birth date|additional parameters}}
Parameter | Default | ||
---|---|---|---|
(required) | 1 | Birth date. May be year only, year and month, year month and day, expressed in natural formats: e.g.: 24 August 1953, 1955-08-25, Sunday, December 7, 1941. If parameter three is not specified, the birth date is displayed in exactly this format. This value as well as parameter 2 may not include links. If links or templates that do not evaluate as recognizable dates are desired, use parameter 2. | – |
(optional) | 2 | The birth date to display. This may include links or templates, or any combination of them, and overrides parameter 1. | parm 1 |
(optional) | bce | If birth date is BC, set to "b". | – |
(optional) | gregorian | If Julian date is used, this parameter is required. The date provided is used for emitting the correct microformat translation of the birth date. | parm 1 |
(optional) | dt | This value if present is the ISO8601 value emitted to indicate microformat birth date. It overrides any calculated value. | – |
Supporting templates
Tracking categories
- Category:Birth-date and age transclusions with invalid parameters (0)
- Category:Date of birth not in Wikidata (0) – added by Template:Birth-date
- Category:Articles without Wikidata item (0) – added by Template:Birth-date and other templates
See also
The above documentation is transcluded from Template:Birth-date and age/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |
Lua-based templates
Pages with script errors
Templates generating microformat date and age
Templates that add a tracking category
Templates tracking Wikidata
Test cases using output parameter
Home > Wiki > MediaWiki > MediaWiki websites > Wikipedia.org website > Wikipedia administration > Wikipedia templates > Wikipedia utility templates > Time, date and calendar templates > Date mathematics templates