I'm messing about with the html5 date input field.
<input type="date" >
I noticed that when you clear the field the value is set to an empty string. So when you post this value to your backend (ASP.NET MVC) the model binder gives a "String was not recognized as a valid DateTime" instead of just setting it to null.
So I was wondering what the easiest way to tell the model binder that when the field type is DateTime an empty string should be parsed to null.
Model example:
public class MyModel
{
public DateTime? MyDate { get; set; }
}
Ctrl example:
public void Post(MyModel model)
{
...
}