Template:Birth date and age: Difference between revisions

From Bhikitia Pro, An open encyclopedia
Blossom (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Blossom (talk | contribs)
No edit summary
Line 1: Line 1:
{{#switch: {{{1|}}}
<noinclude>
| year = {{#expr: {{CURRENTYEAR}} - {{{2}}} }}
{{Documentation}}
| full = {{Birth date and age|{{{2}}}|{{{3}}}|{{{4}}}}}
</noinclude>
| default = {{#expr: {{CURRENTYEAR}} - {{{2}}} }} years old
<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>

Revision as of 16:48, 10 December 2024