Difference between revisions of "Template:IsLeapYear/doc"
Jump to navigation
Jump to search
imported>Bultro m |
imported>Verdy p m |
||
| Line 9: | Line 9: | ||
: Use {{subst:IsLeapYear}} to get this code ready for [[Help:Substitution#Optional_substitution|optional substitution]] into another template. | : Use {{subst:IsLeapYear}} to get this code ready for [[Help:Substitution#Optional_substitution|optional substitution]] into another template. | ||
; Sanity check: | ; Sanity check: | ||
| − | : {{evaldemo/3|IsLeapYear|2000}} | + | : {{evaldemo/3|IsLeapYear|2000}}, 2000 is effectively a leap year, like 1600 but unlike 1900. |
: {{evaldemo/3|IsLeapYear|2007}}, 2007 is not a leap year. | : {{evaldemo/3|IsLeapYear|2007}}, 2007 is not a leap year. | ||
: {{evaldemo/3|IsLeapYear|2008}}, 2008 is a leap year. | : {{evaldemo/3|IsLeapYear|2008}}, 2008 is a leap year. | ||
: {{evaldemo/3|IsLeapYear|2100}}, 2100 is not a leap year. | : {{evaldemo/3|IsLeapYear|2100}}, 2100 is not a leap year. | ||
: {{evaldemo/3|IsLeapYear|2400}}, 2400 is a leap year. | : {{evaldemo/3|IsLeapYear|2400}}, 2400 is a leap year. | ||
| + | : {{evaldemo/3|IsLeapYear|1900}}, 1900 is not a leap year. | ||
: {{evaldemo/3|IsLeapYear|1500}}, [[Proleptic Gregorian calendar|proleptic Gregorian calendar]]. | : {{evaldemo/3|IsLeapYear|1500}}, [[Proleptic Gregorian calendar|proleptic Gregorian calendar]]. | ||
: {{evaldemo/3|IsLeapYear|-100}} for 101 BC (mostly pointless). | : {{evaldemo/3|IsLeapYear|-100}} for 101 BC (mostly pointless). | ||
| − | : {{evaldemo/3|IsLeapYear|502*4-8}}, | + | : {{evaldemo/3|IsLeapYear|502*4-8}}, 2000 is effectively a leap year. |
Results for fractions like {{evaldemo/3|IsLeapYear|2000.9|5==}} are unspecified, even if it apparently gives an "expected" result at the moment this might change without notice. | Results for fractions like {{evaldemo/3|IsLeapYear|2000.9|5==}} are unspecified, even if it apparently gives an "expected" result at the moment this might change without notice. | ||
Revision as of 22:18, 12 September 2009
- Usage:
{{IsLeapYear|year}}- year defaults to
{{CURRENTYEAR}}= 2026. - 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, 2000 is effectively a leap year, like 1600 but unlike 1900.
- {{ 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 | 1900 }} gives 0, 1900 is not 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, 2000 is effectively a leap year.
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.