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

标签 asp.net vb.net html google-chrome asp.net-mvc-4

我有一个使用 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/

相关文章:

.net - UserPrincipal.FindByIdentity坚持 "There is no such object on the server."

asp.net - 如何有选择地在后台线程上运行一些代码?

javascript - 在纯JS中替换字符串的最后一个单词,没有jQuery

javascript - 无法加载文件或程序集 'Noesis.Javascript.dll'

vb.net - 报告查看器 - 内存不足异常

android - Html.fromHtml 在 android 中不显示低 API 21

html - Webpack:加载 *.eot 字体时出现 "OTS parsing error: invalid version tag"

.net - 如何修复 Delphi Prism ASP.NET 错误 : "Parser Error Message: ' Oxygene' is not a supported language"

asp.net - @Url.Action 在参数之间添加 "amp;"在 Controller 中创建空值?

c# - ASP.net 中的 OnCLick 问题