Template:Birth date: Difference between revisions

From WikiMD's Wellness Encyclopedia

No edit summary
No edit summary
Line 1: Line 1:
<span style="display:none">(<span class="bday">{{{1|{{{year}}}}}}-{{padleft:{{MONTHNUMBER|{{{2|{{{month}}}}}}}}|2|0}}-{{padleft:{{{3|{{{day}}}}}}|2|0}}</span>)</span>{{#if:{{{df|}}}
<includeonly>
|{{#expr:{{{3|{{{day}}}}}}}} {{MONTHNAME|{{{2|{{{month}}}}}}}}
{{#if: {{{1|}}}{{{2|}}}{{{3|}}} |
|{{MONTHNAME|{{{2|{{{month<noinclude>|1</noinclude>}}}}}}}} {{#expr:{{{3|{{{day<noinclude>|1</noinclude>}}}}}}}},
  {{#time: Y-m-d | {{{1}}}-{{{2}}}-{{{3}}} }}
}} {{#expr:{{{1|{{{year<noinclude>|1900</noinclude>}}}}}}}}<includeonly><!--
}}
-- Error checks --
</includeonly>
-->{{#ifexpr: ( {{{1|{{{year}}}}}} > {{CURRENTYEAR}} )
<noinclude>
| &#32;{{error|invalid year}}{{main other|[[Category:Pages using age template with invalid date]]}}
== Documentation ==
}}{{#if:{{{2|}}}|{{#ifexpr: ( {{{2|{{{month}}}}}} > 12 ) OR ( {{{2|{{{month}}}}}} < 1 )
This template outputs a formatted birth date.
| &#32;{{error|invalid month}}{{main other|[[Category:Pages using age template with invalid date]]}}|}}
 
}}{{#if:{{{3|}}}|{{#ifexpr: ( {{{3|{{{day}}}}}} > 31 ) OR ( {{{3|{{{day}}}}}} < 1 )
=== Usage ===
| &#32;{{error|invalid day}}{{main other|[[Category:Pages using age template with invalid date]]}}|}}
<syntaxhighlight lang="mediawiki">
}}{{#ifeq: {{NAMESPACENUMBER}} | 0
{{birth|YYYY|MM|DD}}
| {{#if: {{#invoke:wd|label|raw}}
</syntaxhighlight>
  | {{#if: {{#invoke:String|match|{{#invoke:wd|properties|raw|P31}},|Q5,|1|1|true|}}
 
    | {{#if: {{#invoke:wd|properties|raw|P569}}
* `YYYY` - Year of birth (e.g., 1928)
      |
* `MM` - Month of birth (e.g., 10)
      | [[Category:Date of birth not in Wikidata]]
* `DD` - Day of birth (e.g., 10)
      }}
 
    }}
=== Example ===
  | [[Category:Articles without Wikidata item]]
<syntaxhighlight lang="mediawiki">
  }}
{{birth|1928|10|10}}
}}</includeonly><noinclude>
</syntaxhighlight>
{{Documentation}}
 
</noinclude>
Produces:
```plaintext
1928-10-10

Revision as of 00:58, 7 January 2025


Documentation

This template outputs a formatted birth date.

Usage

{{birth|YYYY|MM|DD}}
  • `YYYY` - Year of birth (e.g., 1928)
  • `MM` - Month of birth (e.g., 10)
  • `DD` - Day of birth (e.g., 10)

Example

{{birth|1928|10|10}}

Produces: ```plaintext 1928-10-10