Class DateTimeValidationExtensions
- Namespace
- Admonish
- Assembly
- Admonish.dll
Contains date and time related validation extension methods of ValidationResult.
public static class DateTimeValidationExtensions
- Inheritance
-
DateTimeValidationExtensions
- Inherited Members
Methods
Between(ValidationResult, string, DateTime, DateTime, DateTime, string?)
Ensures that the specified date is within the specified range (inclusive). When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Between(this ValidationResult r, string key, DateTime value, DateTime minValue, DateTime maxValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeThe date to check.
minValueDateTimeThe minimum allowed value.
maxValueDateTimeThe maximum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Between(ValidationResult, string, DateTimeOffset, DateTimeOffset, DateTimeOffset, string?)
Ensures that the specified date is within the specified range (inclusive). When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Between(this ValidationResult r, string key, DateTimeOffset value, DateTimeOffset minValue, DateTimeOffset maxValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeOffsetThe date to check.
minValueDateTimeOffsetThe minimum allowed value.
maxValueDateTimeOffsetThe maximum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Max(ValidationResult, string, DateTime, DateTime, string?)
Ensures that the specified date is less than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Max(this ValidationResult r, string key, DateTime value, DateTime maxValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeThe date to check.
maxValueDateTimeThe maximum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Max(ValidationResult, string, DateTimeOffset, DateTimeOffset, string?)
Ensures that the specified date is less than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Max(this ValidationResult r, string key, DateTimeOffset value, DateTimeOffset maxValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeOffsetThe date to check.
maxValueDateTimeOffsetThe maximum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Min(ValidationResult, string, DateTime, DateTime, string?)
Ensures that the specified date is greater than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Min(this ValidationResult r, string key, DateTime value, DateTime minValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeThe date to check.
minValueDateTimeThe minimum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Min(ValidationResult, string, DateTimeOffset, DateTimeOffset, string?)
Ensures that the specified date is greater than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Min(this ValidationResult r, string key, DateTimeOffset value, DateTimeOffset minValue, string? message = null)
Parameters
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueDateTimeOffsetThe date to check.
minValueDateTimeOffsetThe minimum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.