Class DateInFutureValidationRule
Validation rule for checking that date and time values are in the future.
[ValidationRuleAttribute(typeof(DateInFutureValidationRuleAttribute))]
public class DateInFutureValidationRule : ValidationRule<DateInFutureValidationRuleProperties, DateInFutureValidationRuleClientProperties, DateTime?>, IValidationRule
- Inheritance
-
objectValidationRule<DateInFutureValidationRuleProperties, DateInFutureValidationRuleClientProperties, DateTime?>DateInFutureValidationRule
- Implements
- Inherited Members
- Extension Methods
Remarks
Can be used with the DateTimeInputComponent and
Constructors
DateInFutureValidationRule(ILocalizationService)
Creates a new instance of DateInFutureValidationRule class.
public DateInFutureValidationRule(ILocalizationService localizationService)
Parameters
localizationService
ILocalizationService
Properties
ClientRuleName
Gets the client rule name identifier.
public override string ClientRuleName { get; }
Property Value
- string
DefaultErrorMessage
Defines default error message of the validation rule.
protected override string DefaultErrorMessage { get; }
Property Value
- string
Methods
ConfigureClientProperties(DateInFutureValidationRuleClientProperties)
Allows set validation rule client properties.
protected override Task ConfigureClientProperties(DateInFutureValidationRuleClientProperties clientProperties)
Parameters
clientProperties
DateInFutureValidationRuleClientPropertiesCurrent instance of client properties.
Returns
- Task
Validate(DateTime?, IFormFieldValueProvider)
Validates value
and returns the validation result.
public override Task<ValidationResult> Validate(DateTime? value, IFormFieldValueProvider formFieldValueProvider)
Parameters
value
DateTime?Value to be validated.
formFieldValueProvider
IFormFieldValueProviderProvider of values of other form fields for contextual validation.
Returns
- Task<ValidationResult>
Returns validation result with IsValid set to true, if value is valid. Otherwise returns result with the flag set to false and a corresponding error message.