Difference between revisions of "Template:Daterangedash"
Jump to navigation
Jump to search
imported>Howcheng (←Created page with '{{#if:{{{3}}} |<!--has 3 parameters-->{{#iferror:{{#switch:{{{3}}}|dmy= |dm= | mdy= |md= |{{error|Date format must be one of the following: dmy, dm, mdy, md}}}}...') |
imported>Howcheng |
||
| Line 1: | Line 1: | ||
{{#if:{{{3}}} | {{#if:{{{3}}} | ||
| − | |<!--has 3 parameters-->{{#iferror:{{#switch:{{{3}}}|dmy= |dm= | mdy= |md= |{{error|Date format must be one of the following: dmy, dm, mdy, md}}}} | <!--do nothing else if error--> | + | |<!--has 3 parameters-->{{#iferror:{{#switch:{{{3}}}|dmy=1 |dm=2 | mdy=3 |md=4 |{{error|Date format must be one of the following: dmy, dm, mdy, md}}}} | <!--do nothing else if error--> |
| {{#time:{{#ifexpr:{{str find0|{{{3}}}|md}} > 0 | F j | j F}} | {{{1}}} }}{{#ifeq:{{strendswith|{{{3}}}|y }} | yes | {{#ifexpr:{{str find0|{{{3}}}|md}} > 0 |,|!<!--no comma if day first--> }} {{#time:Y | {{{1}}} }}|<!--do nothing if year not in format string-->}}{{spaced ndash}}{{#time:{{#ifexpr:{{str find0|{{{3}}}|md}} > 0 | F j | j F}} | {{{2}}} }}{{#ifeq:{{strendswith|{{{3}}}|y }} | yes | {{#ifexpr:{{str find0|{{{3}}}|md}} > 0 |,|!<!--no comma if day first--> }} {{#time:Y | {{{2}}} }}|<!--do nothing if year not in format string-->}} }} | | {{#time:{{#ifexpr:{{str find0|{{{3}}}|md}} > 0 | F j | j F}} | {{{1}}} }}{{#ifeq:{{strendswith|{{{3}}}|y }} | yes | {{#ifexpr:{{str find0|{{{3}}}|md}} > 0 |,|!<!--no comma if day first--> }} {{#time:Y | {{{1}}} }}|<!--do nothing if year not in format string-->}}{{spaced ndash}}{{#time:{{#ifexpr:{{str find0|{{{3}}}|md}} > 0 | F j | j F}} | {{{2}}} }}{{#ifeq:{{strendswith|{{{3}}}|y }} | yes | {{#ifexpr:{{str find0|{{{3}}}|md}} > 0 |,|!<!--no comma if day first--> }} {{#time:Y | {{{2}}} }}|<!--do nothing if year not in format string-->}} }} | ||
|<!--does not have 3 parameters--> {{error|Must have three parameters: start date, end date, and format (dmy/dm/mdy/md) }} }} | |<!--does not have 3 parameters--> {{error|Must have three parameters: start date, end date, and format (dmy/dm/mdy/md) }} }} | ||