View source code
Display the source code in std/datetime.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
std.datetime.enforce_valid
- multiple declarations
- Function enforceValid
- Function enforceValid
Function enforceValid
Prototype
void enforceValid(string units)( int value, string file = __FILE__, size_t line = __LINE__ ) pure @safe if (units == "months" || units == "hours" || units == "minutes" || units == "seconds");
Parameters
Name | Description |
---|---|
units | The units of time to validate. |
value | The number to validate. |
file | The file that the DateTimeException will list if thrown. |
line | The line number that the DateTimeException will list if
thrown. |
Throws
DateTimeException
if
is false.
valid
!units(value
)
Function enforceValid
Prototype
void enforceValid(string units)( int year, Month month, int day, string file = __FILE__, size_t line = __LINE__ ) pure @safe if (units == "days");
Parameters
Name | Description |
---|---|
units | The units of time to validate. |
year | The year of the day to validate. |
month | The month of the day to validate. |
day | The day to validate. |
file | The file that the DateTimeException will list if thrown. |
line | The line number that the DateTimeException will list if
thrown. |
Throws
DateTimeException
if
is false.
valid
!"days"(year
, month
, day
)
Authors
Jonathan M Davis and Kato Shoichi