title: Overriding default validation for DateTime
body: <p>I created a custom validation attribute for DateTime that inherits from <strong>RequiredAttribute</strong>. For some reason, some type of built in DateTime validation in MVC is overriding my custom validation because I keep getting the error message "The value 'dd' is not valid for Date" when I type in dd as the value for the date. How do I get it use my custom validator so that my own error message gets displayed instead?</p>
  
  <p>View Model</p>
  
  <pre><code>public class MyViewModel
  {
      [Required(ErrorMessage = "Name is required")]
      [Display(Name = "Name")]
      public string Name { get; set; }
  
      [DateValidation(ErrorMessage = "A valid date is required")]
      [Display(Name = "Date")]
      public DateTime Date { get; set; }
  }
  </code></pre>
  
  <p>Validator</p>
  
  <pre><code>public class DateValidationAttribute : ValidationAttribute
  {
      public override bool IsValid(object value)
      {
          DateTime dt;
  
          return DateTime.TryParse(value.ToString(), out dt);
      }
  }
  </code></pre>
  
  <p>In response to Lars' answer:
  How do I get it to use the error message created in the validation attribute of my model so i can create different error messages for different model properties that use this same validation attribute?</p>