Table of Contents

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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTime

The date to check.

minValue DateTime

The minimum allowed value.

maxValue DateTime

The maximum allowed value.

message string

An 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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTimeOffset

The date to check.

minValue DateTimeOffset

The minimum allowed value.

maxValue DateTimeOffset

The maximum allowed value.

message string

An 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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTime

The date to check.

maxValue DateTime

The maximum allowed value.

message string

An 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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTimeOffset

The date to check.

maxValue DateTimeOffset

The maximum allowed value.

message string

An 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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTime

The date to check.

minValue DateTime

The minimum allowed value.

message string

An 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 ValidationResult

The validation result.

key string

The key to associate the error with.

value DateTimeOffset

The date to check.

minValue DateTimeOffset

The minimum allowed value.

message string

An optional error message.

Returns

ValidationResult

The validation result.