In an asp.net MVC application, I have the following property:
...
public System.DateTime StartTime { get; set; }
...
And, in a view (in a form):
<div class="form-group">
@Html.LabelFor(model => model.StartTime, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.StartTime, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.StartTime, "", new { @class = "text-danger" })
</div>
</div>
in the javascript:
$("#StartTime").datepicker({
dateFormat: "dd/mm/yy",
});
I get the following error with the default jquery validation of asp.net MVC:
The field StartTime must be a date.
I can handle the date in dd/MM/YYYY format without any error in asp.net MVC?