Difference between revisions of "Template:Date"

From Timelines
Jump to: navigation, search
(update after exhaustive development at User:Fullstop/Sandbox/T1 and User:Happy-melon/sandbox1)
(Moved sandbox live to fix wrong output when substituted)
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<onlyinclude><!--
+
{{{{{|safesubst:}}}#switch:none
-->{{#switch:none
+
  |{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
  |{{#iferror: {{#time:Y_M_d|{{{1|}}} }}|none}}
+
  |{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#expr: {{{1|}}}+0 }}
  |{{#switch:{{lc:{{{2|}}}}}|none|asis=none}}
+
    |<noinclude><!--not a pure number--></noinclude>
|{{#ifexpr: {{#time:Y|{{{1|}}} }} < 1582|none}}<!--
+
    |{{{{{|safesubst:}}}#ifexpr: {{{1|}}}+0 > 10000000000000
--> = {{{1|}}}<!-- error or "none", so no formatting -->
+
      |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
|<!-- continue with formatting -->
+
      |{{{{{|safesubst:}}}#ifeq: {{{{{|safesubst:}}}#expr:{{{1|}}}+0}} | {{{1|}}}
  {{#iferror: {{#expr:{{{1|dummy}}} }}
+
          | none <noinclude><!-- pure number eg 123.456 --></noinclude>
  |<!-- input is not just a solitary number -->
+
          | <noinclude><!-- assume yy-mm-dd --></noinclude>
    {{#ifeq:{{#time:Y|{{{1|1 Jan 2000}}} 1996}}{{#time:Y|{{{1|1 Jan 2000}}} 2004}}|19962004
+
        }}
    |<!-- no year -->
+
    }}
      {{#ifeq:{{#time:d|{{{1|}}} 2036}}|{{#time:d|{{{1|}}} }}
+
  }}
      |<!-- month+day -->{{#time:
+
|{{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc:{{{2|}}}}} | none | asis | link | lnone =none }}
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
|{{{{{|safesubst:}}}#ifexpr: {{{{{|safesubst:}}}#time:Y|{{{1|}}} }} < 1000 | none }}
        | lmdy | liso | lymd      = [[:F j]]
+
|{{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
        | mdy  | iso  | ymd      = F j
+
|= {{{{{|safesubst:}}}#if:{{{1|}}}
        | ldmy | l               = [[:j F]]
+
      |{{{{{|safesubst:}}}#switch:{{{2}}}
        | #default                = j F
+
        |link|lnone|l=[[{{{1}}}]]
        }}|{{{1|}}} 2000 }}<!-- default='dmy' or null or "" or unsupported option -->
+
        |{{{1}}}
      |<!-- month only -->{{#time:
+
      }}
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
        | lmdy | liso | lymd
+
|<noinclude><!-- continue with formatting --></noinclude>
        | ldmy | l                = [[F]]
+
  {{{{{|safesubst:}}}#ifeq:<noinclude><!--
        | #default                = F
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2008}}<noinclude><!--
        }}|{{{1|}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt -->
+
    --></noinclude>{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
      }}
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2004}}
    |<!-- with year-->
+
  |20082004
      {{#if: {{#iferror:{{#time:j|2 {{{1|}}}}}|*D*|{{#iferror:{{#time:j|2000 {{{1|}}}}}|*D*| }}}}
+
  |<noinclude><!-- no year --></noinclude>
      |<!-- day+month+year -->{{#time:
+
    {{{{{|safesubst:}}}#ifeq:{{{{{|safesubst:}}}#time:d|{{{1}}} 2036}}|{{{{{|safesubst:}}}#time:d|{{{1}}} }}
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
    |<noinclude><!-- month+day --></noinclude>{{{{{|safesubst:}}}#time:
        | lmdy                   = [[:F j]], [[Y]]
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
        | mdy                     = F j, Y
+
      | lmdy | liso | lymd      = [[:F j]]
        | liso                    = [[Y|Y-]][[F j|m-d]]<!-- i.e. [[Y-m-d]] -->
+
      | mdy | iso | ymd       = F j
        | iso                     = Y-m-d
+
      | ldmy | l                = [[:j F]]
        | lymd                    = [[Y]] [[:F j]]
+
      | #default                = j F
        | ymd                     = Y F j
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
        | ldmy | l                = [[:j F]] [[Y]]
+
    |<noinclude><!-- month only --></noinclude>{{{{{|safesubst:}}}#time:
        | #default                = j F Y
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
        }}|{{{1|}}} }}<!-- #default='dmy' or null or "" or unsupported option -->
+
      | lmdy | liso | lymd  
      |<!-- month+year -->{{#time:
+
      | ldmy | l               = [[F]]
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | #default                = F
        | lmdy | liso | lymd | ldmy | l = [[:F Y]]
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
        | #default                = F Y
 
        }}|{{{1|}}} }}<!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option -->
 
      }}
 
 
     }}
 
     }}
   |<!-- input is a solitary number. Treat it as just a year. -->
+
   |<noinclude><!-- with year--></noinclude>
     {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
    {{{{{|safesubst:}}}#if: {{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2 {{{1|}}}}}|*D*|{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2000 {{{1|}}}}}|*D*| }}}}
    | lmdy | liso | lymd  
+
     |<noinclude><!-- day+month+year --></noinclude>{{{{{|safesubst:}}}#time:
    | ldmy | l                = [[{{#expr:{{{1|}}} }}]]
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
    | #default                = {{#expr:{{{1|}}} }}
+
      | lmdy                   = [[:F j]], [[Y]]
 +
      | mdy                    = F j, Y
 +
      | liso                   = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
 +
      | iso                    = Y-m-d
 +
      | lymd                   = [[Y]] [[:F j]]
 +
      | ymd                    = Y F j
 +
      | ldmy | l                = [[:j F]] [[Y]]
 +
      | #default                = j F Y
 +
      }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
 +
    |<noinclude><!-- month+year --></noinclude>{{{{{|safesubst:}}}#time:
 +
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 +
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
 +
      | #default                = F Y
 +
      }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
 
     }}
 
     }}
 
   }}     
 
   }}     
}}</onlyinclude>
+
}}<noinclude>
 +
{{documentation}}
 +
</noinclude>

Latest revision as of 08:05, 12 September 2015

18 December 2024

Template documentation[create]