Difference between revisions of "Template:LastLeapYear"

From blackwiki
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>Addbot
m (Bot: Migrating 1 interwiki links, now provided by Wikidata on d:q10963829)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{{{{|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>
+
{{#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
Line 18: Line 22:
  
 
[[Category:Date mathematics templates]]
 
[[Category:Date mathematics templates]]
 +
 
</noinclude>
 
</noinclude>

Latest revision as of 01:35, 15 April 2013

2024

Input Current Output Correct Output
1999 1996 1996
2000 2000 2000
2001 2000 2000
2099 2096 2096
2100 2096 2096
2101 2096 2096