In fact, there is another workaround for this. You can just subclass RegularExpressionAttribute
public class DateFormatValidatorAttribute : RegularExpressionAttribute { public DateFormatValidatorAttribute() : base(@"[0-1][0-9]/[0-3][0-9]/20[12][0-9]") { ErrorMessage = "Please enter date in mm/dd/yyyy format"; } public override bool IsValid(object value) { return true; } }
in your Global.asax.cs application, when starting the application, register the RegularExpression add-on for client-side validation as follows:
DataAnnotationsModelValidatorProvider.RegisterAdapter( typeof(DateFormatValidatorAttribute), typeof(RegularExpressionAttributeAdapter));
Now you have the built-in client side of excity MVC authentication and keep the DateTime as the type of your property
source share