valid

Returns whether the given day is valid for the given year and month.

  1. bool valid(int value)
  2. bool valid(int year, int month, int day)
    @safe pure nothrow @nogc
    bool
    valid
    (
    string units
    )
    (
    int year
    ,
    int month
    ,
    int day
    )
    if (
    units == "days"
    )

Parameters

units

The units of time to validate.

year int

The year of the day to validate.

month int

The month of the day to validate (January is 1).

day int

The day to validate.

Examples

assert(valid!"days"(2016, 2, 29));
assert(!valid!"days"(2016, 2, 30));
assert(valid!"days"(2017, 2, 20));
assert(!valid!"days"(2017, 2, 29));

Meta