Template:Birth date and age/doc

From Genwiki

Jump to: navigation, search

Usage

These templates ({{Birth date}} and {{Birth date and age}}) return a person's date of birth and optionally his/her age.

Syntax:

{{Birth date|year of birth|month of birth|day of birth}}

or

{{Birth date and age|year of birth|month of birth|day of birth}}

Examples:

{{Birth date|1993|2|24}} returns "{{#ifeq:{{{df}}}|yes|[[24 {{#if:2|{{#switch:{{#if:2|{{#switch:2|january|jan=1|february|feb=2|march|mar=3|apr|april=4|may=5|june|jun=6|july|jul=7|august|aug=8|september|sep=9|october|oct=10|november|nov=11|december|dec=12|{{#ifexpr:2<0|{{#ifexpr:((2)round 0)!=(2)|{{#expr:12-(((0.5-(2))round 0)mod 12)}}|{{#expr:12-(((11.5-(2))round 0)mod 12)}}}}|{{#expr:(((10.5+2)round 0)mod 12)+1}}}}}}|Missing required parameter 1=month!}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}}]]|[[{{#if:2|{{#switch:{{#if:2|{{#switch:2|january|jan=1|february|feb=2|march|mar=3|apr|april=4|may=5|june|jun=6|july|jul=7|august|aug=8|september|sep=9|october|oct=10|november|nov=11|december|dec=12|{{#ifexpr:2<0|{{#ifexpr:((2)round 0)!=(2)|{{#expr:12-(((0.5-(2))round 0)mod 12)}}|{{#expr:12-(((11.5-(2))round 0)mod 12)}}}}|{{#expr:(((10.5+2)round 0)mod 12)+1}}}}}}|Missing required parameter 1=month!}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} 24]]}} 1993(1993-{{#ifeq:x2|x0|00|02}}-{{#ifeq:x24|x0|00|24}})"
{{Birth date and age|1993|2|24}} returns {{#ifeq:{{{df}}}|yes|[[24 {{#if:2|{{#switch:{{#if:2|{{#switch:2|january|jan=1|february|feb=2|march|mar=3|apr|april=4|may=5|june|jun=6|july|jul=7|august|aug=8|september|sep=9|october|oct=10|november|nov=11|december|dec=12|{{#ifexpr:2<0|{{#ifexpr:((2)round 0)!=(2)|{{#expr:12-(((0.5-(2))round 0)mod 12)}}|{{#expr:12-(((11.5-(2))round 0)mod 12)}}}}|{{#expr:(((10.5+2)round 0)mod 12)+1}}}}}}|Missing required parameter 1=month!}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}}]]|[[{{#if:2|{{#switch:{{#if:2|{{#switch:2|january|jan=1|february|feb=2|march|mar=3|apr|april=4|may=5|june|jun=6|july|jul=7|august|aug=8|september|sep=9|october|oct=10|november|nov=11|december|dec=12|{{#ifexpr:2<0|{{#ifexpr:((2)round 0)!=(2)|{{#expr:12-(((0.5-(2))round 0)mod 12)}}|{{#expr:12-(((11.5-(2))round 0)mod 12)}}}}|{{#expr:(((10.5+2)round 0)mod 12)+1}}}}}}|Missing required parameter 1=month!}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} 24]]}} 1993 (1993-{{#ifeq:x2|x0|00|02}}-{{#ifeq:x24|x0|00|24}}) (age {{#expr:(2024)-( 1993 )-((04)<( 2 )or(04)=( 2 )and(25)<( 24 ))}})

The templates also return the date, hidden by CSS, in the ISO 8601 format needed by hCard microformats. for example:

(<span class="bday">1993-02-24</span>)

See the microformats project for details.

Note: The template will appear broken when the parameters are left blank (as seen above).


Personal tools