我们对MS Edge中的数据时间格式有疑问。我们的网站在IE中以IE中的正确格式(dd / MM / yyyy)正常运行,但是如果我们使用MS Edge,则验证会引发错误(为有效日期)
我们想要维护文本框,我们不需要任何数据选择器
我们尝试了两种方法:
方法1:
@Html.TextBoxFor(m => m.ConfigBPAValue.PurchaseDate, "{0:dd/MM/yyyy}", new { @class = "form-control default-date-picker" })
方法2:
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public DateTime Quarter0Date { get; set; }
@Html.TextBoxFor(m => m.ConfigBPAValue.Quarter0Date, new { @class = "form-control" })
在两种情况下,应用程序都希望使用(yyyy / MM / dd)格式。
我们错过了什么吗?
谢谢
我更改了参考文献
@Scripts.Render("~/Scripts/jquery-1.12.4.min.js")
@Scripts.Render("~/Scripts/jquery.validate.js")
@Scripts.Render("~/Scripts/jquery.validate.unobtrusive.js")
按
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
现在可以正常工作