gpt4 book ai didi

asp.net - JQuery Mobile 日期选择器不在 Chrome 中显示日期

转载 作者:搜寻专家 更新时间:2023-10-31 08:32:42 25 4
gpt4 key购买 nike

我有一个使用 JQuery Mobile 的 MVC 4 网站。我正在使用带有 EditorFor 的模型来呈现日期编辑器。在 MVC 中我有这个:

@Html.EditorFor(Function(model) model.ActionDate)

模型属性定义为:

<Required>
<RegularExpression("\d{2}/\d{2}/\d{4}", ErrorMessage:="Please enter a date in the format of MM/DD/YY")>
<DataType(DataType.Date)>
<DisplayFormat(ApplyFormatInEditMode:=True, DataFormatString:="MM/dd/yyyy")>
<Display(Name:="Action Date")>
Public Property ActionDate As Date

它呈现具有以下值的 HTML:

<input type="date" ... value="04/24/2013" />

但是向用户显示的是:

Date Picker with Date not Showing

日期对用户不可见,并且 4/24/2013 不是 Chrome 日期选择器的默认值。如何让 chrome 真正显示日期?

谢谢。

最佳答案

根据 the W3C ,传递给 <input type="date"> 的值元素应该在 RFC3339 中格式。这是ISO8601的具体简介.

也就是说,你需要传递yyyy-MM-dd中的值格式。

关于asp.net - JQuery Mobile 日期选择器不在 Chrome 中显示日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19460833/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com