core
core copied to clipboard
INPUT tag helper for DateTime (.NET Core 3)
INPUT tag helper for DateTime data type generates INPUT element of type "datetime-local". This element type has bad browser support and it often doesn't work.
EXAMPLE Data deinition (from the data model):
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd.MM.yyyy. HH:mm}")]
public DateTime LastProcessedDateTime { get; set; }
Razor view:
<input asp-for="LastProcessedDateTime" class="form-control" readonly />
Generated HTML:
<input class="form-control" readonly="" type="datetime-local" data-val="true" data-val-required="The Vrijeme posljednje obrade field is required." id="LastProcessedDateTime" name="LastProcessedDateTime" value="08.06.2017. 08:59">
The result is visible on the attached image (Chrome).

This issue was moved to aspnet/AspNetCore#10992