Difference between revisions of "Template:LastLeapYear"

From blackwiki
Jump to navigation Jump to search
imported>Plastikspork
(+ table to test template)
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)
Line 1: Line 1:
{{#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4 - floor({{{1|{{CURRENTYEAR}}}}}/100)*100 + floor({{{1|{{CURRENTYEAR}}}}}/400)*400 }}<noinclude>
+
{{{{{|safesubst:}}}#ifeq:{{{{{|safesubst:}}}#time:L|1 January {{{{{|safesubst:}}}#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4}}}}|1<!-- if last year divisible by 4 is a leap year -->|{{{{{|safesubst:}}}#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4}}<!-- else go back 4 more years from last year divisible by 4 -->|{{{{{|safesubst:}}}#expr: floor({{{1|{{CURRENTYEAR}}}}}/4)*4 - 4}}<!-- end if -->}}<noinclude>
 
{| class="wikitable"
 
{| class="wikitable"
 
! Input !! Current Output !! Correct Output
 
! Input !! Current Output !! Correct Output

Revision as of 23:12, 30 April 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