Difference between revisions of "Template:IsLeapYear/doc"
Jump to navigation
Jump to search
imported>Verdy p m |
imported>Verdy p m |
||
| Line 10: | Line 10: | ||
; Sanity check: | ; Sanity check: | ||
: {{evaldemo/3|IsLeapYear|2000}}, 2000 is effectively a leap year. | : {{evaldemo/3|IsLeapYear|2000}}, 2000 is effectively a leap year. | ||
| − | : {{evaldemo/3|IsLeapYear| | + | : {{evaldemo/3|IsLeapYear|2001}}, 2001 is not a leap year. |
: {{evaldemo/3|IsLeapYear|2004}}, 2004 is a leap year. | : {{evaldemo/3|IsLeapYear|2004}}, 2004 is a leap year. | ||
: {{evaldemo/3|IsLeapYear|2007}}, 2007 is not a leap year. | : {{evaldemo/3|IsLeapYear|2007}}, 2007 is not a leap year. | ||
Revision as of 22:33, 12 September 2009
- Usage:
{{IsLeapYear|year}}- year defaults to
{{CURRENTYEAR}}= 2026. It must be specified in the Gregorian calendar, extended to all epochs using linear year numbering: use the proleptic Gregorian calendar in Christian Era before the change, and the astronomical year convention (using negative numbers, and year 0) in all years AD before the Christian era (there's a difference of 1 in absolute value). - 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.
- {{ IsLeapYear | 2001 }} gives 0, 2001 is not a leap year.
- {{ IsLeapYear | 2004 }} gives 1, 2004 is a leap year.
- {{ IsLeapYear | 2007 }} gives 0, 2007 is not a leap year.
- {{ IsLeapYear | 2008 }} gives 1, 2008 is a leap year.
- {{ IsLeapYear | 2009 }} gives 0, 2009 is not a leap year.
- {{ IsLeapYear | 2100 }} gives 0, 2100 is not a leap year in the Gregorian calendar.
- {{ IsLeapYear | 2400 }} gives 1, 2400 is effectively a leap year.
- {{ IsLeapYear | 1900 }} gives 0, 1900 is not a leap year in the Gregorian calendar.
- {{ IsLeapYear | 1800 }} gives 0, 1800 is not a leap year in the Gregorian calendar.
- {{ IsLeapYear | 1600 }} gives 1, 1600 is effectively a leap year.
- {{ IsLeapYear | 1700 }} gives 0, 1700 is not a leap year in the Gregorian calendar.
- {{ IsLeapYear | 1500 }} gives 0, 1500 is not a leap year proleptic Gregorian calendar (but is leap in the actual Julian 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.