Difference between revisions of "Template:Date"

From Timelines
Jump to: navigation, search
(improved method of excluding bad dates from 1000-1583 era)
(update to improve handling of pure-number inputs, per talk)
Line 1: Line 1:
 
{{#switch:none
 
{{#switch:none
  |{{#iferror: {{#time:Y_M_d|{{{1|}}} }}|none}}
+
  |{{#iferror: {{#time:Y_M_d|{{{1|}}} }} | none }} <!-- #time: can't handle -->
  |{{#switch: {{lc:{{{2|}}}}}|none|asis=none}}
+
|{{#iferror: {{#expr: {{{1|}}}+0 }}
  |{{#ifexpr: {{#time:Y|{{{1|}}} }} < 1000|none}}
+
    |<!--not a pure number-->
  |{{#switch: {{#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}<!--
+
    |{{#ifexpr: {{{1|}}}+0 > 10000000000000
--> = {{{1|}}}<!-- error or "none", so no formatting -->
+
      |<!-- a yyyymmddhhmmss timestamp -->
 +
      |{{#ifeq: {{#expr:{{{1|}}}+0}} | {{{1|}}}
 +
          | none <!-- pure number eg 123.456 -->
 +
          | <!-- assume yy-mm-dd -->
 +
        }}
 +
    }}
 +
  }}
 +
  |{{#switch: {{lc:{{{2|}}}}} | none | asis=none }}
 +
  |{{#ifexpr: {{#time:Y|{{{1|}}} }} < 1000 | none }}
 +
  |{{#switch: {{#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
 +
|= {{{1|}}}<!-- error or "none", so no formatting -->
 
  |<!-- continue with formatting -->
 
  |<!-- continue with formatting -->
   {{#ifeq:{{#time:Y|{{{1|1 Jan 2000}}} 2008}}{{#time:Y|{{{1|1 Jan 2000}}} 2004}}|20082004
+
   {{#ifeq:<!--
 +
    -->{{#time:Y|{{{1}}} 2008}}<!--
 +
    -->{{#iferror: {{#ifexpr: {{{1}}}>10000000000000 | no }} | }}<!--
 +
    -->{{#time:Y|{{{1}}} 2004}}
 +
  |20082004
 
   |<!-- no year -->
 
   |<!-- no year -->
     {{#ifeq:{{#time:d|{{{1|}}} 2036}}|{{#time:d|{{{1|}}} }}
+
     {{#ifeq:{{#time:d|{{{1}}} 2036}}|{{#time:d|{{{1}}} }}
 
     |<!-- month+day -->{{#time:
 
     |<!-- month+day -->{{#time:
 
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
Line 15: Line 29:
 
       | ldmy | l                = [[:j F]]
 
       | ldmy | l                = [[:j F]]
 
       | #default                = j F
 
       | #default                = j F
       }}|{{{1|}}} 2000 }}<!-- default='dmy' or null or "" or unsupported option -->
+
       }}|{{{1}}} 2000 }}<!-- default='dmy' or null or "" or unsupported option -->
 
     |<!-- month only -->{{#time:
 
     |<!-- month only -->{{#time:
 
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
Line 21: Line 35:
 
       | ldmy | l                = [[F]]
 
       | ldmy | l                = [[F]]
 
       | #default                = F
 
       | #default                = F
       }}|{{{1|}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt -->
+
       }}|{{{1}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt -->
 
     }}
 
     }}
 
   |<!-- with year-->
 
   |<!-- with year-->

Revision as of 11:44, 6 February 2009

18 December 2024 Lua error in Module:Effective_protection_level at line 60: attempt to index field 'TitleBlacklist' (a nil value).

Template documentation[create]