Vorlage:Date: Unterschied zwischen den Versionen

Aus skandinavien-wiki.net
(update to improve handling of pure-number inputs, per talk)
K (89 Versionen von wpen:Template:Date importiert)
 
(12 dazwischenliegende Versionen von 8 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
{{#switch:none
{{safesubst:<noinclude/>#switch:none
  |{{#iferror: {{#time:Y_M_d|{{{1|}}} }} | none }} <!-- #time: can't handle -->
  |{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
  |{{#iferror: {{#expr: {{{1|}}}+0 }}
  |{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#expr: {{{1|}}}+0 }}
     |<!--not a pure number-->
     |<noinclude><!--not a pure number--></noinclude>
     |{{#ifexpr: {{{1|}}}+0 > 10000000000000
     |{{safesubst:<noinclude/>#ifexpr: {{{1|}}}+0 > 10000000000000
       |<!-- a yyyymmddhhmmss timestamp -->
       |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
       |{{#ifeq: {{#expr:{{{1|}}}+0}} | {{{1|}}}
       |{{safesubst:<noinclude/>#ifeq: {{safesubst:<noinclude/>#expr:{{{1|}}}+0}} | {{{1|}}}
           | none <!-- pure number eg 123.456 -->
           | none <noinclude><!-- pure number eg 123.456 --></noinclude>
           | <!-- assume yy-mm-dd -->
           | <noinclude><!-- assume yy-mm-dd --></noinclude>
         }}
         }}
     }}
     }}
   }}
   }}
  |{{#switch:  {{lc:{{{2|}}}}} | none | asis=none }}
  |{{safesubst:<noinclude/>#switch:  {{safesubst:<noinclude/>lc:{{{2|}}}}} | none | asis | link | lnone =none }}
  |{{#ifexpr:  {{#time:Y|{{{1|}}} }} < 1000 | none }}
  |{{safesubst:<noinclude/>#ifexpr:  {{safesubst:<noinclude/>#time:Y|{{{1|}}} }} < 1000 | none }}
  |{{#switch:  {{#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
  |{{safesubst:<noinclude/>#switch:  {{safesubst:<noinclude/>#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
  |= {{{1|}}}<!-- error or "none", so no formatting -->
  |= {{safesubst:<noinclude/>#if:{{{1|}}}
  |<!-- continue with formatting -->
      |{{safesubst:<noinclude/>#switch:{{{2}}}
   {{#ifeq:<!--
        |link|lnone|l=[[{{{1}}}]]
     -->{{#time:Y|{{{1}}} 2008}}<!--
        |{{{1}}}
     -->{{#iferror: {{#ifexpr: {{{1}}}>10000000000000 | no }} | }}<!--
      }}
     -->{{#time:Y|{{{1}}} 2004}}
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
  |<noinclude><!-- continue with formatting --></noinclude>
   {{safesubst:<noinclude/>#ifeq:<noinclude><!--
     --></noinclude>{{safesubst:<noinclude/>#time:Y|{{{1}}} 2008}}<noinclude><!--
     --></noinclude>{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
     --></noinclude>{{safesubst:<noinclude/>#time:Y|{{{1}}} 2004}}
   |20082004
   |20082004
   |<!-- no year -->
   |<noinclude><!-- no year --></noinclude>
     {{#ifeq:{{#time:d|{{{1}}} 2036}}|{{#time:d|{{{1}}} }}
     {{safesubst:<noinclude/>#ifeq:{{safesubst:<noinclude/>#time:d|{{{1}}} 2036}}|{{safesubst:<noinclude/>#time:d|{{{1}}} }}
     |<!-- month+day -->{{#time:
     |<noinclude><!-- month+day --></noinclude>{{safesubst:<noinclude/>#time:
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       | lmdy | liso | lymd      = [[:F j]]
       | lmdy | liso | lymd      = [[:F j]]
       | mdy  | iso  | ymd      = F j
       | mdy  | iso  | ymd      = F j
       | 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 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
     |<!-- month only -->{{#time:
     |<noinclude><!-- month only --></noinclude>{{safesubst:<noinclude/>#time:
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       | lmdy | liso | lymd  
       | lmdy | liso | lymd  
       | ldmy | l                = [[F]]
       | ldmy | l                = [[F]]
       | #default                = F
       | #default                = F
       }}|{{{1}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt -->
       }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
     }}
     }}
   |<!-- with year-->
   |<noinclude><!-- with year--></noinclude>
     {{#if: {{#iferror:{{#time:j|2 {{{1|}}}}}|*D*|{{#iferror:{{#time:j|2000 {{{1|}}}}}|*D*| }}}}
     {{safesubst:<noinclude/>#if: {{safesubst:<noinclude/>#iferror:{{safesubst:<noinclude/>#time:j|2 {{{1|}}}}}|*D*|{{safesubst:<noinclude/>#iferror:{{safesubst:<noinclude/>#time:j|2000 {{{1|}}}}}|*D*| }}}}
     |<!-- day+month+year -->{{#time:
     |<noinclude><!-- day+month+year --></noinclude>{{safesubst:<noinclude/>#time:
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       | lmdy                    = [[:F j]], [[Y]]
       | lmdy                    = [[:F j]], [[Y]]
       | mdy                    = F j, Y
       | mdy                    = F j, Y
       | liso                    = [[Y|Y-]][[F j|m-d]]<!-- i.e. [[Y-m-d]] -->
       | liso                    = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
       | iso                    = Y-m-d
       | iso                    = Y-m-d
       | lymd                    = [[Y]] [[:F j]]
       | lymd                    = [[Y]] [[:F j]]
Zeile 49: Zeile 54:
       | ldmy | l                = [[:j F]] [[Y]]
       | ldmy | l                = [[:j F]] [[Y]]
       | #default                = j F Y
       | #default                = j F Y
       }}|{{{1|}}} }}<!-- #default='dmy' or null or "" or unsupported option -->
       }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
     |<!-- month+year -->{{#time:
     |<noinclude><!-- month+year --></noinclude>{{safesubst:<noinclude/>#time:
       {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
       | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
       | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
       | #default                = F Y
       | #default                = F Y
       }}|{{{1|}}} }}<!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option -->
       }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
     }}
     }}
   }}     
   }}     
}}<noinclude>
}}<noinclude>
{{pp-template|small=yes}}
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>

Aktuelle Version vom 13. Januar 2023, 13:13 Uhr

17 Februar 2026

Template-info.png Dokumentation für die Vorlage {{Date}}[Ansicht] [Bearbeiten] [Versionsgeschichte] [Aktualisieren]
Für die Vorlage {{Date}} gibt es noch keine Dokumentation. Du kannst sie aber anlegen.
Hinweise