How do validate a string as DateTime using FluentValidation
- by Richard Nienaber
With FluentValidation, is it possible to validate a string as a parseable DateTime without having to specify a Custom() delegate?
Ideally, I'd like to say something like the EmailAddress function, e.g.:
RuleFor(s => s.EmailAddress).EmailAddress().WithMessage("Invalid email address");
So something like this:
RuleFor(s => s.DepartureDateTime).DateTime().WithMessage("Invalid date/time");