I am trying to validate my date input field with asp-validation, but I keep getting this type of error 
This is what I did in my Model:
public static readonly DateTime MinDate = new DateTime(2000, 01, 01);
public static readonly DateTime MaxDate = DateTime.Now.AddMonths(-4);
[Display(Name = "Date of Birth:")]
[Range(typeof(DateTime), nameof(MinDate), nameof(MaxDate), ErrorMessage = "Date must be between January 1, 2000 and 4 months from now.")]
I tried to simply type the date as strings to see if my code runs properly and it does.
[Range(typeof(DateTime), "01/01/2000", "02/06/2022", ErrorMessage = "Date must be between January 1, 2000 and 4 months from now.")]
I believe the way I am using the DateTime object is wrong, although I can't figure out what the issue is exactly.
The problem is that attributes accept only constants as parameters. DateTime object can not be a constant. But you can create a custom attribute