我有一个属性
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:hh:mmtt}")]
public DateTime DeadlineTime { get; set; }
在页面
上使用它 <div class="form-group">
@Html.LabelFor(model => model.DeadlineTime, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DeadlineTime, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DeadlineTime, "", new { @class = "text-danger" })
</div>
</div>
但当我尝试输入值时:11:30 PM我收到验证码错误:
DeadlineTime字段必须是日期。
为什么以及如何解决它?