Difference between revisions of "Template:ISOdate"

From Self-sufficiency
Jump to: navigation, search
(fixes for some forms of date in the first century)
m (24 revisions from commons:Template:ISOdate)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#ifeq: {{{1|}}} | | |
+
{{#switch: 1
{{#if: {{#iferror: {{#expr: {{{1}}} }} | | {{#ifeq: {{{1}}} | {{#expr: {{{1}}} }} |1|}} }}
+
|{{#ifexpr: ({{#ifeq: {{{1|}}} | | 1|0}}) or (({{#iferror: {{#expr: {{{1}}} }} | 1 | {{#ifeq: {{{1}}} | {{#expr: {{{1}}} }} |0|1}} }}) and ({{#iferror: {{#time: | {{{1}}} }}{{#time: | a{{{1}}} }} | 1 | 0 }}) and ({{#iferror: {{#expr: {{{1}}} }} | 1 | 0 }})) | 1}}={{{1|}}}
| {{date|{{{1}}}||| {{{2|}}} |form= {{{form|}}} }}
+
|{{#if: {{#iferror: {{#expr: {{{1}}} }} | | {{#ifeq: {{{1}}} | {{#expr: {{{1}}} }} |1|}} }}
| {{#iferror: {{#time: | {{{1}}} }}{{#time: | a{{{1}}} }}
+
| 1 }}={{date|{{{1}}}||| {{{2|}}} |form= {{{form|}}} }}
| {{#iferror: {{#expr: {{{1}}} }}
+
|{{#ifexpr: ({{#iferror: {{#expr: {{{1}}} }} | 1 | 0 }}=1) and ({{#iferror: {{#time: | {{{1}}} }}{{#time: | a{{{1}}} }} | 1 | 0 }})|1}}={{{1}}}
| {{{1}}}
+
|{{#ifexpr: ({{#iferror: {{#expr: {{{1}}} }} |0|1}}) and ({{{1}}} <= 998) and ({{{1}}} >= -11)|1}}=
| {{#ifexpr: ({{{1}}} <= 998) and ({{{1}}} >= -11)
+
{{#switch: 1
| {{#iferror: {{#time: Y | {{padleft:{{{1}}}|7|0}} }}
+
|{{#ifexpr: ({{{1}}} <= 998) and ({{{1}}} >= -11) and ({{#iferror: {{#time: Y | {{padleft:{{{1}}}|7|0}} }}|1|0}}=1)|1}}={{{1}}}
| {{{1}}}
+
|{{#ifexpr: ({{{1}}} <= 998) and ({{{1}}} >= -11) and ({{#ifexpr: ({{#time: Y | {{padleft:{{{1}}}|7|0}} }} >= 1958) and ({{{1}}} <= 98) |1|0}}=1)|1}}={{#ifeq: {{{1}}} | {{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: m | {{padleft:{{{1}}}|7|0}} }}}}|| {{{2|}}} |form= {{{form|}}} }} | {{#ifeq: {{{1}}} | {{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }}-{{#time: d | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: m | {{padleft:{{{1}}}|7|0}} }}}}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: d | {{padleft:{{{1}}}|7|0}} }}}}| {{{2|}}} |form= {{{form|}}} }} | {{{1}}} }} }}
| {{#ifexpr: ({{#time: Y | {{padleft:{{{1}}}|7|0}} }} >= 1958) and ({{{1}}} <= 98)
+
|{{#ifexpr: ({{{1}}} <= 998) and ({{{1}}} >= -11)|1}}={{#ifeq: {{{1}}} | {{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: m | {{padleft:{{{1}}}|7|0}} }}}}|| {{{2|}}} |form= {{{form|}}} }} | {{#ifeq: {{{1}}} | {{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }}-{{#time: d | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: m | {{padleft:{{{1}}}|7|0}} }}}}| {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: d | {{padleft:{{{1}}}|7|0}} }}}}| {{{2|}}} |form= {{{form|}}} }} | {{{1}}} }} }}
| {{#ifeq: {{{1}}} | {{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: y | {{padleft:{{{1}}}|7|0}} }} }}|{{#time: m | {{padleft:{{{1}}}|7|0}} }}|| {{{2|}}} |form= {{{form|}}} }} | {{{1}}} }}
+
|#default={{{1}}}
| {{#ifeq: {{{1}}} | {{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}-{{#time: m | {{padleft:{{{1}}}|7|0}} }} | {{date|{{#expr: {{#time: Y | {{padleft:{{{1}}}|7|0}} }} }}|{{#time: m | {{padleft:{{{1}}}|7|0}} }}|| {{{2|}}} |form= {{{form|}}} }} | {{{1}}} }}
+
 
}}
 
}}
}}
+
|#default=
| {{{1}}}
+
{{#ifexpr: ({{#ifeq: {{padleft:{{{1}}}|8|#}} | #{{{1}}} | 1 | 0 }}) and ({{#iferror: {{#expr: {{{1}}} > 100 }} | 0 | {{#ifexpr: {{{1}}} > 100 | 1 | 0 }} }}) | {{date| {{#expr: {{#time: Y | {{{1}}}-01 }} }} | {{#ifeq: {{uc: {{{f|}}} }} | Y | |{{#time: n | {{{1}}}-01 }}}} || {{{2|}}} |form= {{{form|}}} }} | {{#switch: {{{1}}}  
}}
+
}}
+
| {{#ifexpr: ({{#ifeq: {{padleft:{{{1}}}|8|#}} | #{{{1}}} | 1 | 0 }}) and ({{#ifexpr: {{{1}}} > 100 | 1 | 0 }}) | {{date| {{#expr: {{#time: Y | {{{1}}}-01 }} }} | {{#ifeq: {{uc: {{{f|}}} }} | Y | |{{#time: n | {{{1}}}-01 }}}} || {{{2|}}} |form= {{{form|}}} }} | {{#switch: {{{1}}}  
+
 
|{{#expr: {{#time:Y| {{{1}}} }} - 1900 }}-{{#time:m-d H:i:sZ| {{{1}}} }}
 
|{{#expr: {{#time:Y| {{{1}}} }} - 1900 }}-{{#time:m-d H:i:sZ| {{{1}}} }}
 
|{{#expr: {{#time:Y| {{{1}}} }} - 1900 }}-{{#time:m-d H:i:s| {{{1}}} }}={{date| {{#expr: {{#time:Y| {{{1}}} }} - 1900 }} | {{#ifeq: {{uc: {{{f|}}} }} | Y | |{{#time: n | {{{1}}} }}}} | {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: j | {{{1}}} }} }} | {{{2|}}} |form= {{{form|}}} }}{{#ifeq: {{uc: {{{f|}}} }} | Y | | {{date-time separator|{{{2|}}}}}{{Time|{{#time: H | {{{1}}} }}|{{#time: i | {{{1}}} }}|{{#time: s | {{{1}}} }}|Z|lang= {{{2|}}} }} }}
 
|{{#expr: {{#time:Y| {{{1}}} }} - 1900 }}-{{#time:m-d H:i:s| {{{1}}} }}={{date| {{#expr: {{#time:Y| {{{1}}} }} - 1900 }} | {{#ifeq: {{uc: {{{f|}}} }} | Y | |{{#time: n | {{{1}}} }}}} | {{#ifeq: {{uc: {{{f|}}} }} | Y | | {{#time: j | {{{1}}} }} }} | {{{2|}}} |form= {{{form|}}} }}{{#ifeq: {{uc: {{{f|}}} }} | Y | | {{date-time separator|{{{2|}}}}}{{Time|{{#time: H | {{{1}}} }}|{{#time: i | {{{1}}} }}|{{#time: s | {{{1}}} }}|Z|lang= {{{2|}}} }} }}
Line 37: Line 33:
 
|{{#expr:{{#time:Y| {{{1}}} }}}}={{date| {{#expr:{{#time: Y | {{{1}}} }}}} ||| {{{2|}}} |form= {{{form|}}} }}
 
|{{#expr:{{#time:Y| {{{1}}} }}}}={{date| {{#expr:{{#time: Y | {{{1}}} }}}} ||| {{{2|}}} |form= {{{form|}}} }}
 
|#default= {{{1}}}
 
|#default= {{{1}}}
}}
 
}}
 
 
}}
 
}}
 
}}
 
}}

Latest revision as of 20:59, 20 September 2010