I have a model property that I'll save DateTime
:
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:yyyy-MM-ddThh:mm:ssZ}")]
public DateTime DataInicio { get; set; }
I want to convert to an html field of type ( type="datetime-local"
)
<input type="datetime-local">
As I'm trying to do:
@Html.EditorFor(model => model.DataInicio, "{0:yyyy-MM-ddThh:mm:ssZ}", new {type = "datetime-local" })
I put this formatting, put the type, put the attribute in the model, tried with ApplyFormatInEditMode = true and false and nothing works, at most it gets type="datetime"
and nda.
It's getting like this:
<input class="text-box single-line" id="DataInicio" name="DataInicio" type="datetime" value="">