yearIsLeapYear

Whether the given Gregorian Year is a leap year.

@safe pure nothrow @nogc
bool
yearIsLeapYear
(
int year
)

Parameters

year int

The year to to be tested.

Examples

foreach (year; [1, 2, 100, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010])
{
    assert(!yearIsLeapYear(year));
    assert(!yearIsLeapYear(-year));
}

foreach (year; [0, 4, 8, 400, 800, 1600, 1996, 2000, 2004, 2008, 2012])
{
    assert(yearIsLeapYear(year));
    assert(yearIsLeapYear(-year));
}

Meta