日期未显示在 EditorFor 中

Date not displaying in EditorFor

我想在 editorfor 字段中显示数据库中的值,但它仍为空白。该值存在于值字段中但不显示在页面中。

如果我使用以下解决方案:

Display a formatted date in an EditorFor()

@Html.TextBoxFor(m => m.Van, new { @Value = model.Van.ToString("yyyy/MM/dd"), @class="datepicker" })

我得到了值,但没有得到 EditorFor 字段默认提供的日期选择器。

型号:

[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime Van{ get; set; }

查看:

@Html.EditorFor(model => model.Van, new { htmlAttributes = new { @class = "form-control" } })

将格式更改为 "yyyy/MM/dd" 后,这是一个 Chrome 问题。