Table of Contents

Class DateTimeValidator

Namespace
CloudyWing.FormValidators
Assembly
CloudyWing.FormValidators.dll

Validation constrains the date time format of a value.

public sealed class DateTimeValidator : ComparableTypeValidator<DateTime>, IFormValidator
Inheritance
DateTimeValidator
Implements
Inherited Members

Constructors

DateTimeValidator(string, string, Func<string, string, DateTime?, DateTime?, string>)

Initializes a new instance of the DateTimeValidator class.

public DateTimeValidator(string column, string value, Func<string, string, DateTime?, DateTime?, string> customErrorMessageAccessor = null)

Parameters

column string

The column.

value string

The value.

customErrorMessageAccessor Func<string, string, DateTime?, DateTime?, string>

The custom error message accessor. The arguments are column, value, min, max.

DateTimeValidator(string, string, DateTime?, DateTime?, Func<string, string, DateTime?, DateTime?, string>)

Initializes a new instance of the ComparableTypeValidator<T> class.

public DateTimeValidator(string column, string value, DateTime? min, DateTime? max, Func<string, string, DateTime?, DateTime?, string> customErrorMessageAccessor = null)

Parameters

column string

The column.

value string

The value.

min DateTime?

The minimum.

max DateTime?

The maximum.

customErrorMessageAccessor Func<string, string, DateTime?, DateTime?, string>

The custom error message accessor. The arguments are column, value, min, max.

Properties

CastErrorMessageAccessor

Gets the cast error message accessor.

protected override Func<string, string, string> CastErrorMessageAccessor { get; }

Property Value

Func<string, string, string>

The cast error message accessor.

Methods

TryParse(string, out DateTime)

Tries the parse.

protected override bool TryParse(string value, out DateTime result)

Parameters

value string

The value.

result DateTime

The result.

Returns

bool

Parse value to type T result.