Template:Birth date and age: Difference between revisions

From Bhikitia Pro, An open encyclopedia
Blossom (talk | contribs)
No edit summary
Blossom (talk | contribs)
No edit summary
 
Line 3: Line 3:
</noinclude>
</noinclude>
<includeonly>
<includeonly>
{{#if: {{{1|}}} <!-- Check if the first parameter (birthdate) is provided -->
{{#if:{{{1|}}}|
  | {{#time:j F Y|{{{1}}}}} <!-- Format the birth date (e.g., 21 September 1934) -->
    {{#time:j F Y|{{{1}}}}}
    ({{#expr: {{CURRENTYEAR}} - {{#time:Y|{{{1}}}}} <!-- Calculate age -->
| ''No date provided''
      {{#ifexpr: {{CURRENTMONTH}} < {{#time:n|{{{1}}}}} or ({{CURRENTMONTH}} = {{#time:n|{{{1}}}}} and {{CURRENTDAY}} < {{#time:j|{{{1}}}}})
        | -1 <!-- Subtract 1 year if the current date is before the birthdate -->
        | 0
      }}
    }}})
  | ''No date provided'' <!-- Default text if no date is provided -->
}}
}}
</includeonly>
</includeonly>

Latest revision as of 16:52, 10 December 2024