core icon indicating copy to clipboard operation
core copied to clipboard

INPUT tag helper for DateTime (.NET Core 3)

Open mcurko opened this issue 7 years ago • 1 comments

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).

Untitled

mcurko avatar Apr 18 '19 11:04 mcurko

This issue was moved to aspnet/AspNetCore#10992

Pilchie avatar Jun 07 '19 16:06 Pilchie