@Html.EditorFor(model => model.Birthdate)
public static class DatetimeHelpers
{
public static IHtmlString Date(this HtmlHelper helper, string name, object value)
{
return Date(helper, name, value, null);
}
public static IHtmlString Date(this HtmlHelper helper, string name, object value, object htmlAttributes)
{
var tagBuilder = new TagBuilder("input");
tagBuilder.Attributes["name"] = name;
tagBuilder.Attributes["value"] = value.ToString();
tagBuilder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
return MvcHtmlString.Create(tagBuilder.ToString());
}
}
@Html.Date("Birthdate", Model.Birthdate, new { id = "Birthdate" })
Source: https://habr.com/ru/post/141704/