Porter Hoskins
Porter Hoskins

Reputation: 581

Text Field won't populate default date in HTML5 field

In the HTML5 date input type, Chrome will not put in a default date. The field is rendered empty. Other browsers will have the date, but Chrome has a default date selector that may be causing some of the issues. Any ideas?

<input type="date" class="input-xlarge" id="date" name="date" pattern="(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d" value="@Model.Date.ToString("MM/dd/yyyy")" required />

Upvotes: 1

Views: 486

Answers (1)

int32_t
int32_t

Reputation: 6150

HTML5 date value format is yyyy-MM-dd, not MM/dd/yyyy.

Upvotes: 1

Related Questions