ASP.Net Core MVC date input value
type="date"
generates the browsers HTML-5 datepicker if supported. The specifications require that the value be formatted in ISO format (yyyy-MM-dd
) which is then displayed in accordance with the browsers culture.
Add the asp-format
to format the value, and remove the value
attribute (Tag Helpers correctly generate the value
attribute for correct 2-way model binding and you should never attempt to add it yourself)
<input asp-for="BestellungsDatum" type="date" asp-format="{0:yyyy-MM-dd}" class="form-control" />
Note the HTML-5 datepicker is not supported in IE, and only in recent versions of FireFox. If you want a consistent UI, then consider using a jQuery datepicker instead.