ASP.NET MVC jQuery Unobtrusive Validation to compare between two dates
Clash Royale CLAN TAG #URR8PPP ASP.NET MVC jQuery Unobtrusive Validation to compare between two dates I'm trying to validate StartDate and EndDate using System.ComponentModel.DataAnnotations , such that the End Date must not be lesser than the Start Date. In my Model, I have defined the dates as follows: StartDate EndDate System.ComponentModel.DataAnnotations public partial class MyModel { [Required] public DateTime StartDate { get; set; } [Required] public DateTime EndDate { get; set; } } And I have also created a View Model as follows: public class CompareDateVM : IValidatableObject { public MyModel myModel { get; set; } public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { if (myModel.EndDate < myModel.StartDate) { yield return new ValidationResult(errorMessage: "End Date cannot be lesser than Start Date.", memberNames: new { "EndD...