Difference between revisions of "Template:Start date and age"

From LIMSWiki
Jump to navigationJump to search
m (Protected "Template:Start date and age" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
Line 1: Line 1:
<includeonly><!--
<includeonly><!--


     IMPLEMENTATION OF DATE
     IMPLEMENTATION OF DATE


-->{{#if: {{{1|}}}<!--
-->{{#if: {{{1|}}}<!--
   -->|{{#if: {{{2|}}}<!--
   -->|{{#if: {{{2|}}}<!--
     -->|{{#if: {{{3|}}}<!--
     -->|{{#if: {{{3|}}}<!--
         -->|{{#ifeq: {{{df|}}}|yes<!--
         -->|{{#ifeq:{{yesno|{{{df|no}}}}}|yes<!--
           -->|{{#expr:{{{3}}}}} {{MONTHNAME|{{{2}}}}}<!--
           -->|{{#expr:{{{3}}}}}&nbsp;{{MONTHNAME|{{{2}}}}}<!--
           -->|{{MONTHNAME|{{{2}}}}} {{#expr:{{{3}}}}},<!--
           -->|{{MONTHNAME|{{{2}}}}}&nbsp;{{#expr:{{{3}}}}},<!--
        -->}} {{{1}}}<!--
          -->}} {{{1}}}<!--
         -->|{{MONTHNAME|{{{2}}}}} {{{1}}}<!--
         -->|{{MONTHNAME|{{{2}}}}}&nbsp;{{{1}}}<!--
      -->}}<!--
        -->}}<!--
     -->|{{{1}}}<!--
     -->|{{{1}}}<!--
  -->}}<!--
  --><span class="noprint">; <!--
    -->{{#ifeq:{{{br|}}}|yes|<br/>|}}<!--
    -->{{time ago<!--
      -->|{{{1}}}<!--
        -->-<!--
        -->{{{2|{{CURRENTMONTH}}}}}<!--
        -->-<!--
        -->{{{3|{{CURRENTDAY}}}}}<!--
      -->|min_magnitude=days<!--
     -->}}<!--
     -->}}<!--
  --></span><!--
    --><span class="noprint">{{#ifeq:{{yesno|{{{paren|{{{p|no}}}}}}}}|yes||&#059;}}<!--
   -->|'''{{color|red|Error: No parameters}}'''<!--
    -->{{#ifeq:{{yesno|{{{br|no}}}}}|yes|<br/>|&#032;}}<!--
    -->{{#ifeq:{{yesno|{{{paren|{{{p|no}}}}}}}}|yes|(}}<!--
    -->{{#if: {{{2|}}}<!--
      -->|{{#if: {{{3|}}}<!--
          -->|{{time ago|{{{1}}}-{{{2}}}-{{{3}}}|min_magnitude=days}}<!--
          -->|{{years or months ago|{{{1}}}|{{#time:n|1-{{trim|{{{2}}}}}-1}}}}<!--
          -->}}<!--
      -->|{{#iferror:{{#expr:{{{1}}}}}<!--
          -->|{{time ago|{{{1}}}|min_magnitude=days}}<!--
          -->|{{years or months ago|{{{1}}}}}<!--
          -->}}<!--
      -->}}<!--
    -->{{#ifeq:{{yesno|{{{paren|{{{p|no}}}}}}}}|yes|)}}</span><!--
   -->|{{Error|Error: first parameter is missing.|tag=span}}<!--
-->}}<!--
-->}}<!--


     IMPLEMENTATION OF microformat date classes
     IMPLEMENTATION OF microformat date classes


 
--><span style="display:none">&#160;(<span class="{{#ifeq:{{yesno|{{{end|no}}}}}|yes|dtend|bday dtstart published updated}}"><!--
--><span style="display:none">&#160;(<span class="bday dtstart published updated"><!--
-->{{#if: {{{1|}}}<!--
-->{{#if: {{{1|}}}<!--
   -->|{{{1}}}<!--
   -->|{{{1}}}<!--
   -->{{#if: {{{2|}}}<!--
   -->{{#if: {{{2|}}}<!--
     -->| -{{padleft:{{{2}}}|2|0}}<!--
     -->| -{{#time:m|1-{{trim|{{{2}}}}}-1}}<!--
      -->{{#if: {{{3|}}}<!--
      -->{{#if: {{{3|}}}<!--
        -->| -{{padleft:{{{3}}}|2|0}}<!--
        -->| -{{padleft:{{{3}}}|2|0}}<!--
      -->}}<!--
        -->}}<!--
  -->}}<!--
    -->}}<!--
-->}}<!--
  -->}}<!--
--></span>)</span></includeonly><noinclude>
--></span>)</span></includeonly><noinclude>
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>

Revision as of 21:43, 4 February 2020

[edit] [purge] Template documentation

Usage

Syntax

Common usage
{{Start date and age|yyyy|mm|dd}} to display formatted as:
March 25, 2010; 14 years ago (2010-Error: Invalid time.-25)
{{Start date and age|yyyy|mm|dd|df=yes}} to display formatted as:
25 March 2010; 14 years ago (2010-Error: Invalid time.-25)
Full syntax
{{Start date and age|yyyy|mm|dd|df=yes|p=yes|br=yes}} to display formatted as:
25 March 2010
(14 years ago)
 (2010-Error: Invalid time.-25)
Description of parameters
Parameter Description
yyyy Four digits indicating the year. The year must always appear in a 4-digits form.
mm A number between 1 to 12, indicating the month. Leading zeros in the number are ignored.
dd A number between 1 to 31, indicating the day of the month. Leading zeros in the number are ignored.
df= The optional parameter df can either be set to yes or anything other than yes. When set to yes, date will be displayed in DMY format: 4 March 2010. When set something other than yes or when this parameter is not included, date will be displayed in MD,Y format: March 4, 2010.
br= The optional parameter br can either be set to yes or anything other than yes. When set to yes, a line break will be inserted between the date and the age. When set something other than yes or when this parameter is not included, a breaking space will be inserted between the date and the age. In either case, a semicolon separates the date and age, immediately before the line break or space.

Examples

Syntax Result
{{Start date and age|2010|01|02}} January 2, 2010; 14 years ago (2010-Error: Invalid time.-02)
{{Start date and age|2008|08|09}} August 9, 2008; 16 years ago (2008-Error: Invalid time.-09)
{{Start date and age|2003|07|05}} July 5, 2003; 21 years ago (2003-Error: Invalid time.-05)
{{Start date and age|2010|1|2|df=yes}} 2 January 2010; 14 years ago (2010-Error: Invalid time.-02)
{{Start date and age|2008|8|9|df=yes}} 9 August 2008; 16 years ago (2008-Error: Invalid time.-09)
{{Start date and age|2003|7|5|df=yes}} 5 July 2003; 21 years ago (2003-Error: Invalid time.-05)
{{Start date and age|2009|9|9|br=yes}} September 9, 2009;
15 years ago
 (2009-Error: Invalid time.-09)
Today:
{{Start date and age|2024|11|22}}
November 22, 2024; 0 days ago (2024-Error: Invalid time.-22)
Yesterday:
{{Start date and age|2024|11|21}}
November 21, 2024; 1 day ago (2024-Error: Invalid time.-21)