Template:Cal-date/offset: Difference between revisions
From MediaWiki
Jump to navigationJump to searchmNo edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{#if:{{{monthoffset|}}}| | {{#if:{{{monthoffset|}}}| | ||
{{#switch:{{#expr: {{{monthoffset}}} + {{{ | {{#switch:{{#expr: {{{monthoffset}}} + {{{offset|0}}}}} | ||
|0=12 | |0=12 | ||
|13=1 | |13=1 | ||
|{{#expr: {{{monthoffset}}} + {{{ | |{{#expr: {{{monthoffset}}} + {{{offset|0}}}}} | ||
}} | }} | ||
|}}<!-- | |||
Get the number of days in a month | |||
-->{{#if:{{{daysinmonth|}}}| | |||
{{#switch:{{{daysinmonth}}} | |||
|1=31 | |||
|2=29 | |||
|3=31 | |||
|4=30 | |||
|5=31 | |||
|6=30 | |||
|7=31 | |||
|8=31 | |||
|9=30 | |||
|10=31 | |||
|11=30 | |||
|12=31 | |||
| | |||
}}|}}<!-- | |||
isnextmonth | |||
params: isnextMonth (day), offset, month | |||
-->{{#if:{{{isnextmonth|}}}|{{#if|{{#expr: ({{{isnextmonth}}} + {{{offset|0}}}) > {{cal-date/offset_recurs|daysinmonth={{{month|}}}}} }}|1|0}}|}}<!-- | |||
Get the day offset | |||
NOTE: THIS DOES NOT WORK IF THE NUMBER OF DAYS BEING OFFSET IS MORE THAN 1, SUCK ON IT. | |||
--><!--{{#if:{{{dayoffset|}}}| | |||
{{#if|{{#expr: ({{{dayoffset}}} + {{{offset|0}}}) < 1 }}|{{cal-date/offset_recurs|daysinmonth={{cal-date/offset_recurs|monthoffset=1}} }}|}} | |||
if day + > days in month, day = day+ - days in month. Month++ | |||
|}} | |}} | ||
--> | |||

