enforceValid

fnvoid enforceValid(string units)(int value, string file = __FILE__, size_t line = __LINE__) if (units == "months" || units == "hours" || units == "minutes" || units == "seconds") @safe pure

Parameters

unitsThe units of time to validate.
valueThe number to validate.
fileThe file that the DateTimeException will list if thrown.
lineThe line number that the DateTimeException will list if thrown.

Throws

DateTimeException if valid!units(value) is false.
fnvoid enforceValid(string units)(int year, Month month, int day, string file = __FILE__, size_t line = __LINE__) if (units == "days") @safe pure

Because the validity of the day number depends on both on the year and month of which the day is occurring, take all three variables to validate the day.

Parameters

unitsThe units of time to validate.
yearThe year of the day to validate.
monthThe month of the day to validate.
dayThe day to validate.
fileThe file that the DateTimeException will list if thrown.
lineThe line number that the DateTimeException will list if thrown.

Throws

DateTimeException if valid!"days"(year, month, day) is false.