2
I have a model property that I will keep DateTime
:
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:yyyy-MM-ddThh:mm:ssZ}")]
public DateTime DataInicio { get; set; }
I want to convert into an html field of the type (type="datetime-local"
)
<input type="datetime-local">
Like I’m trying to do:
@Html.EditorFor(model => model.DataInicio, "{0:yyyy-MM-ddThh:mm:ssZ}", new {type = "datetime-local" })
I put this format, put the type, put the attribute in the model, tried with Applyformatineditmode = true and false and nothing works, at most it is type="datetime"
and nda.
he’s getting like this:
<input class="text-box single-line" id="DataInicio" name="DataInicio" type="datetime" value="">
Try to take out Datetypeattribute and switch to @Html.Textboxfor(model => model.Datastart, "{0:yyyy-MM-ddThh:mm:ssZ}", new {type = "datetime-local" })
– Pablo Tondolo de Vargas