This project is read-only.


input type="date" not in correct format


I just ran across this issue today in Chrome. If you create a page with the following

public class Model {
    public DateTime LastModified { get; set; }
@Html.EditorFor(x => x.LastModified)
Generates This:
<input type="date" value="01/01/2001" />
However the specs require an RFC 3339 / ISO 8601 Date. The Chrome browser refuses to use the date in this format. Here is the line to the spec.

In order to get this to work in MVC4 I have to use the following:
    name: "LastModified"
    value: Model.LastModified.ToString("yyyy-MM-dd"),
    htmlAttributes: new { type="date" })
Closed Jun 5, 2013 at 11:21 PM by kenegozi


gldmelo wrote May 14, 2013 at 10:46 PM

This bug is giving me a lot of headaches. Please fix it soon.

yishaigalatzer wrote Jun 5, 2013 at 10:50 PM

looks the same like 630.

kenegozi wrote Jun 5, 2013 at 11:13 PM

This is a duplicate of 630 indeed.

@gldmelo, please take a look at the fix -
specifically the file test/System.Web.Mvc.Test/Html/Test/DefaultEditorTemplatesTest.cs, lines 682-693 that demonstrate the older, and the (optional) new way of rendering input-date tags.