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
columnstringThe column.
valuestringThe value.
customErrorMessageAccessorFunc<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
columnstringThe column.
valuestringThe value.
minDateTime?The minimum.
maxDateTime?The maximum.
customErrorMessageAccessorFunc<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
Methods
TryParse(string, out DateTime)
Tries the parse.
protected override bool TryParse(string value, out DateTime result)
Parameters
Returns
- bool
Parse value to type
Tresult.