Template:IsLeapYear/doc

From Wikipedia, the free encyclopedia


Usage:
{{IsLeapYear|year}}
year defaults to {{ CURRENTYEAR }} = 2007.
Formula:
{{#expr: ((({{{1}}}) mod 4 = 0) and (({{{1}}}) mod 100 != 0)) or (({{{1}}}) mod 400 = 0)}}
Use {{subst:IsLeapYear}} to get this code ready for optional substitution into another template.
Sanity check:
{{ IsLeapYear | 2000 }} gives 1
{{ IsLeapYear | 2007 }} gives 0, 2007 is not a leap year.
{{ IsLeapYear | 2008 }} gives 1, 2008 is a leap year.
{{ IsLeapYear | 2100 }} gives 0, 2100 is not a leap year.
{{ IsLeapYear | 2400 }} gives 1, 2400 is a leap year.
{{ IsLeapYear | 1500 }} gives 0, proleptic Gregorian calendar.
{{ IsLeapYear | -100 }} gives 0 for 101 BC (mostly pointless).
{{ IsLeapYear | 502*4-8 }} gives 1, guess why.

Results for fractions like {{ IsLeapYear | 2000.9 }} = 1 are unspecified, even if it apparently gives an "expected" result at the moment this might change without notice.