Template:Age: Difference between revisions

From Stellar Kennings
Jump to navigation Jump to search
(todo: fix this for personal use.)
(documentation and date update.)
Line 1: Line 1:
<includeonly>{{#expr:({{{4|{{CURRENTYEAR}}+377}}})-({{{1}}})-(({{{5|{{CURRENTMONTH}}}}})<({{{2}}})or({{{5|{{CURRENTMONTH}}}}})=({{{2}}})and({{{6|{{CURRENTDAY}}}}})<({{{3}}}))}}</includeonly><noinclude>
<includeonly>{{#expr:({{{4|2153}}})-({{{1}}})-(({{{5|4}}})<({{{2}}})or({{{5|4}}})=({{{2}}})and({{{6|2}}})<({{{3}}}))}}</includeonly><noinclude>


This *was* based on SB118's Age template, but it should be noted that this template assumes you are entering a date in the dedication year.
This template returns an age from either a specified date, or the reference date for the current state of writing, which is April 2nd, 2153.
(Note: Will need some time to unwind the template to tag it vs. the current date assigned to it.)
 
As such, on this wiki, use the "age at a certain date" code for now.
 
It auto calculates the current age so you don't have to update it.


===Reference===
===Reference===
;How to Use<nowiki>:</nowiki>
;How to Use<nowiki>:</nowiki>
:To calculate the number of years between the current stardate and your specified date (e.g., current age):
:To calculate the number of years between the reference date and an entered date
::<nowiki>{{age|year1|month1|day1}}</nowiki>
::<nowiki>{{age|year1|month1|day1}}</nowiki>
:To calculate the number of years between two dates (e.g., age at time of death):
:To calculate the number of years between two dates (e.g., age at time of death):
Line 16: Line 11:


; Examples<nowiki>:</nowiki>
; Examples<nowiki>:</nowiki>
:'''Current Age:''' Ens. Smith was born on SD 235308.18. That is, she was born on August 18, 2353. To find out how old she is based on today's stardate, you would use the following code:
:'''Current Age:''' Ens. Smith was born on August 18, 2333.  
:: <nowiki>{{age|2353|8|18}}</nowiki>
:: <nowiki>{{age|2333|8|18}}</nowiki>
:which gives you her current age: '''{{age|2353|8|18}}'''
:which gives you her current age: '''{{age|2333|8|18}}'''


:'''Age at a Specific Date:''' She was on Deep Space 17 when it was captured by the Vaadwaur on SD 238706.16 (i.e., June 16, 2387). How old was she then?
:'''Age at a Specific Date:''' She was on Starbase 49 when peace was declared on 2352.12.01 CE
::<nowiki>{{age|2353|8|18|2387|6|16}}</nowiki>
::<nowiki>{{age|2333|8|18|2352|12|1}}</nowiki>
:which gives you: '''{{age|2353|8|18|2387|6|16}}'''
:which gives you: '''{{age|2333|8|18|2352|12|1}}'''


'''Notice that you do NOT add leading zeros for the month or day if it is a single digit.'''
'''Notice that you do NOT add leading zeros for the month or day if it is a single digit.'''


: When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
: When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
:: Example: <nowiki>{{subst:age|2353|8|18|2387|6|16}}</nowiki>
:: Example: <nowiki>{{subst:age|2333|8|18|2352|12|1}}</nowiki>
:When a template is substituted on a page, the code will be permanently replaced with the calculated value.
:When a template is substituted on a page, the code will be permanently replaced with the calculated value.



Revision as of 13:14, 11 June 2022


This template returns an age from either a specified date, or the reference date for the current state of writing, which is April 2nd, 2153.

Reference

How to Use:
To calculate the number of years between the reference date and an entered date
{{age|year1|month1|day1}}
To calculate the number of years between two dates (e.g., age at time of death):
{{age|year1|month1|day1|year2|month2|day2}}
Examples:
Current Age: Ens. Smith was born on August 18, 2333.
{{age|2333|8|18}}
which gives you her current age: -181
Age at a Specific Date: She was on Starbase 49 when peace was declared on 2352.12.01 CE
{{age|2333|8|18|2352|12|1}}
which gives you: 19

Notice that you do NOT add leading zeros for the month or day if it is a single digit.

When using this template to calculate a person's age at death or a person's age on a specified date (rather than the person's current age), please substitute it into the page.
Example: {{subst:age|2333|8|18|2352|12|1}}
When a template is substituted on a page, the code will be permanently replaced with the calculated value.
When entering dates before the Common Era, use astronomical year numbering: 1 BCE is represented by 0, 2 BCE by -1, 3 BCE by -2 etc. For example, the following expression returns the number of full years between the current stardate and the Battle of Cannae, which took place on August 2, 216 BCE:
{{age|-215|8|2}} returns "2367"
Note:
This template does not check for incorrect input:
{{age|1980|7|14|1993|6|233}} returns "12" (surplus days do not count as extra months)
{{age|1980|7|14|1993|88|14}} returns "13" (surplus months do not count as extra years)