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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeThe date to check.
minValue
DateTimeThe minimum allowed value.
maxValue
DateTimeThe maximum allowed value.
message
stringAn 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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeOffsetThe date to check.
minValue
DateTimeOffsetThe minimum allowed value.
maxValue
DateTimeOffsetThe maximum allowed value.
message
stringAn 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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeThe date to check.
maxValue
DateTimeThe maximum allowed value.
message
stringAn 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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeOffsetThe date to check.
maxValue
DateTimeOffsetThe maximum allowed value.
message
stringAn 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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeThe date to check.
minValue
DateTimeThe minimum allowed value.
message
stringAn 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
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
DateTimeOffsetThe date to check.
minValue
DateTimeOffsetThe minimum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.