I have a Datetime field in my Model and need to validate it so that when it is created it has to fall between Now and 6 Years Prior. I have
Use this attribute:
public class CustomDateAttribute : RangeAttribute { public CustomDateAttribute() : base(typeof(DateTime), DateTime.Now.AddYears(-6).ToShortDateString(), DateTime.Now.ToShortDateString()) { } }