I have a model which is of DateTime type and want to create textbox for it. The default generated control's type is datetime-local. I want to change it to date only since I don't need the time. However, for some reason the type always turned to text type after loading is finished.
Here is my code
<div class="form-group">
<label asp-for="Order.TanggalOrder" class="control-label">Tanggal Order</label>
<input asp-for="Order.TanggalOrder" type="date" class="" />
<input asp-for="Order.TanggalOrder" type="time" class="form-control" />
<span asp-validation-for="Order.TanggalOrder" class="text-danger"></span>
</div>
As you can see, the browser rendered the date input correctly for a brief moment, then turned into text. The datepicker is still there, but the input validation (dd/mm/yyyy text and calendar icon ) is no longer there.
This happens only with date type, as I tried it with time or datetime and they're still rendered properly.
Any clue on what I have to do? I'm using the .net 5 mvc.


