Template:Birth date and age: Difference between revisions
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
No edit summary |
||
| Line 1: | Line 1: | ||
{{# | <noinclude> | ||
| | {{Documentation}} | ||
</noinclude> | |||
<includeonly> | |||
{{#if: {{{1|}}} <!-- Check if a birth year is provided --> | |||
| {{#time:j F Y|{{{1}}}}} <!-- Format the birth date --> | |||
({{#expr: {{CURRENTYEAR}} - {{#time:Y|{{{1}}}}} <!-- Calculate age --> | |||
{{#ifexpr: {{CURRENTMONTH}} < {{#time:n|{{{1}}}}} or ({{CURRENTMONTH}} = {{#time:n|{{{1}}}}} and {{CURRENTDAY}} < {{#time:j|{{{1}}}}}) | |||
| -1 <!-- Subtract 1 if birthday hasn't occurred this year --> | |||
| 0 | |||
}}}) | |||
| ''No date provided'' <!-- Default text if no date is provided --> | |||
}} | }} | ||
</includeonly> | |||