RangeAttribute をオーバーライドするこのクラスがあります。
public class RangeDateAttribute : RangeAttribute
{
public RangeDateAttribute()
: base(typeof(DateTime),
DateTime.Now.AddYears(-20).ToShortDateString(), DateTime.Today.ToShortDateString()) { }
}
私の属性の DataAnnotation:
[RangeDate(ErrorMessage = "Value for {0} must be between {1} and {2}")]
public DateTime anyDate { get; set; }
私はその検証でメソッド [ToShortDateString()] を使用していますが、エラーを表示すると、時刻が表示されます..例:
Value for anyDate must be between 26/05/1995 00:00:00 and 26/05/2015 00:00:00
どうすればこれを解決できますか?
ありがとう。