MVC .Net Core Model Validation – The value ” is invalid. Error

In order to make your Required attribute works you need to make field nullable:

public DateTime? AppointmentDate { get; set; }

Edit: also note that DataType attribute actually doesn’t perform validation on field. MVC validate date when applying binding from post data to model

Leave a Comment