|
|
Line 1: |
Line 1: |
| + | <noinclude> |
| See if we can create a template where we can show the n-th day of the month, like the ''first sunday'' or ''second to last saturday'' (months can have 4 or 5 of the same weekdays in it) | | See if we can create a template where we can show the n-th day of the month, like the ''first sunday'' or ''second to last saturday'' (months can have 4 or 5 of the same weekdays in it) |
| | | |
| Params: | | Params: |
− | * {{{1|1}}} defaults to 'first'. positive numbers mean first (1), second (2).. Other numbers mean last (0), second to last (-1) | + | * {{{nth|1}}} defaults to 'first'. positive numbers mean first (1), second (2).. Other numbers mean last (0), second to last (-1) |
− | * {{{2|6}}} defaults to 'Saturday' 0=Sunday, 1=Monday... | + | * {{{day|6}}} defaults to 'Saturday' 0=Sunday, 1=Monday... |
− | * {{{3|jan}}} defaults to month of upcoming occurrence (this or next month) | + | * {{{month|{{CURRENTMONTH}}}}} defaults to month of upcoming occurrence (this or next month) |
− | * {{{4|2018}}} defaults to year of upcoming occurrence (this or next year) | + | * {{{year|{{CURRENTYEAR}}}}} defaults to year of upcoming occurrence (this or next year) |
| | | |
| + | The use of '''<nowiki>{{</nowiki>{{PAGENAME}}<nowiki>}}</nowiki>''' would result in: |
| + | </noinclude> |
| + | {{#ifexpr: {{{nth|1}}} > 0 |
| + | | above 0:{{#expr: {{#ifexpr: {{{day|6}}} >= {{#time: w|1-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }} | 1 | 8 }} + {{{day|6}}} - {{#time: w|1-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }} + ({{{nth|1}}} - 1 ) * 7 }}-{{{month|{{CURRENTMONTH}}}}} |
| | | |
− | * determine weekday for the beginning of the month, requested, end of the month
| + | | 0 and below:{{#expr: {{#ifexpr: {{{day|6}}} > {{#time: w|{{#time: t | 1-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }}-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }} | -7 | 0 }} + {{#time: t | 1-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }} + {{{day|6}}} - {{#time: w|{{#time: t | 1-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }}-{{{month|{{CURRENTMONTH}}}}}-{{{year|{{CURRENTYEAR}}}}} }} + ({{{nth|1}}}) * 7 }}-{{{month|{{CURRENTMONTH}}}}} |
− | *:{{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}, {{{2|6}}}, {{#time: w|0-{{#expr: {{CURRENTMONTH}}+1}}-{{CURRENTYEAR}} }}
| + | }} |
− | * nth week in the month
| |
− | *: {{#expr: ({{{1|1}}} - 1 ) * 7 }}
| |
− | * requested weekday > month-day ? rd - md : 7 + rd - md
| |
− | * working:
| |
− | *: the (first) (saturday) of the month is: {{#expr: {{#ifexpr: {{{2|6}}} >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + {{{2|6}}} - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + ({{{1|1}}} - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the first saturday of the month is: {{#expr: {{#ifexpr: 6 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 6 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (1 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the second saturday of the month is: {{#expr: {{#ifexpr: 6 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 6 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (2 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the fourth saturday of the month is: {{#expr: {{#ifexpr: 6 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 6 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (4 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the fifth saturday of the month is: {{#expr: {{#ifexpr: 6 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 6 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (5 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the first wednesday of the month is: {{#expr: {{#ifexpr: 3 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 3 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (1 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the second wednesday of the month is: {{#expr: {{#ifexpr: 3 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 3 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (2 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the first Tuesay of the month is: {{#expr: {{#ifexpr: 2 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 2 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (1 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | *: the second Tuesday of the month is: {{#expr: {{#ifexpr: 2 >= {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | 1 | 8 }} + 2 - {{#time: w|1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (2 - 1 ) * 7 }}-{{CURRENTMONTH}}
| |
− | | |
− | * TODO:
| |
− | *: the last saturday of the month is: {{#expr: {{#ifexpr: 6 > {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | -7 | 0 }} + {{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 6 - {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 0 * 7 }}-{{CURRENTMONTH}}
| |
− | *: the last wednesday of the month is: {{#expr: {{#ifexpr: 3 > {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | -7 | 0 }} + {{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 3 - {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 0 * 7 }}-{{CURRENTMONTH}}
| |
− | *: the last Tuesday of the month is: {{#expr: {{#ifexpr: 2 > {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | -7 | 0 }} + {{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 2 - {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 0 * 7 }}-{{CURRENTMONTH}}
| |
− | *: the second to last saturday of the month is: {{#expr: {{#ifexpr: 6 > {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} | -7 | 0 }} + {{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + 6 - {{#time: w|{{#time: t | 1-{{CURRENTMONTH}}-{{CURRENTYEAR}} }}-{{CURRENTMONTH}}-{{CURRENTYEAR}} }} + (-1) * 7 }}-{{CURRENTMONTH}}
| |
− | | |
− | | |
− | <!--
| |
− | {{#expr: 7 - {{#time: w|1-{{CurrentQuarterMonth}}-{{CURRENTYEAR}} }} }}-{{CurrentQuarterMonth}}-{{CURRENTYEAR}} }} | |
− | | |
− | | |
− | {{#ifexpr: {{NextQuarterMonth}} < {{CURRENTMONTH}} | {{#expr: 7 - {{#time: w|1-{{NextQuarterMonth}}-{{#expr:{{CURRENTYEAR}}+1}} }} }}-{{NextQuarterMonth}}-{{#expr:{{CURRENTYEAR}}+1}} | {{#expr: 7 - {{#time: w|1-{{NextQuarterMonth}}-{{CURRENTYEAR}} }} }}-{{NextQuarterMonth}}-{{CURRENTYEAR}} }}
| |
− | | |
− | | |
− | {{#ifexpr: {{#time: U | now }} > {{#time: U | {{CurrentQuarterMeetingDate}} 19:00 }} | {{NextQuarterMeetingDate}} | {{CurrentQuarterMeetingDate}} }}
| |
− | -->
| |