Difference between revisions of "Template:LastLeapYear"
Jump to navigation
Jump to search
imported>Plastikspork (this should fix it, use {{#time:L|1 January {{{1}}} }} which returns 1 for leap years, and 0 otherwise, then go back 4 more years if not a leap year) |
imported>Waldyrious (clear up code: use {{IsLeapYear}} (see talk page), add whitespace for readability, and remove safesubst (this template is not meant to be substituted anyway)) |
||
Line 1: | Line 1: | ||
− | {{ | + | {{#ifeq: {{IsLeapYear| {{#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4}} }} | 1 <!-- if last year divisible by 4 is a leap year --> |
+ | | {{#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4}} <!-- use it --> | ||
+ | | {{#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4 - 4}} <!-- else go back 4 more years from last year divisible by 4 --> | ||
+ | }}<noinclude> | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Input !! Current Output !! Correct Output | ! Input !! Current Output !! Correct Output |
Revision as of 00:56, 1 May 2011
2024
Input | Current Output | Correct Output |
---|---|---|
1999 | 1996 | 1996 |
2000 | 2000 | 2000 |
2001 | 2000 | 2000 |
2099 | 2096 | 2096 |
2100 | 2096 | 2096 |
2101 | 2096 | 2096 |