with asp.net, how can pass javascript date into input with type datetime.
input tag:
<input asp-for="EndingDate" id="enddate" class="form-control input-sm" />
and the attempt to send javascript date to the input value:
const d = new Date("2015-03-25");
$('#enddate').val(d.toJSON());
3
Answers
Did you try below.
This will assign date time to asp.net text filed. But no-masking and calendar. If the field have calendar then you need to call calendar initiate method after this.
The form post should work as it is.
Try this
If your
EndingDate
is type of DateTime, it will generate the input withtype="datetime-local"
.Change your code below: