我有一個使用JQuery Mobile的MVC 4網站。我正在使用帶有EditorFor的模型來呈現日期編輯器。在MVC我有這樣的:JQuery Mobile日期選取器未在Chrome中顯示日期
@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" />
但是顯示給用戶的是這樣的:
日期對用戶不可見,並且4/24/2013不是Chrome日期選擇器的默認值。我如何獲得chrome來實際顯示日期?
謝謝。
Chrome瀏覽器正在爲日期字段*進行各種「智能」編輯,這些日期字段正在推動我們堅持*。我的解決方案(下文)只是簡單地將字段類型從'date'改爲'text'。 –