I have a DateTimePicker in my view, binding to my model's DateTime field, like this:
With this ViewModel: (I've omitted the irrelevant fields)
1.
@Html.Kendo().DateTimePickerFor(m => m.ReceiptDateTime);
With this ViewModel: (I've omitted the irrelevant fields)
1.
public
class
ReceiptViewModel
2.
{
3.
public
DateTime ReceiptDateTime {
get
;
set
; }
4.
}
Now, I'm trying to post this to a WebAPI controller in ASP.NET Web API using JSON. I've tried many ways, but the controller never receives the value for the DateTime and sets it at a default "{1-1-0001 0:00:00}". How can I send the date to the controller?
How should I format the date in javascript?
1.
var
receipt = {
2.
/* more fields here */
3.
ReceiptDateTime: $(
"#ReceiptDateTime"
).data(
"kendoDateTimePicker"
).value()
4.
};
How should I format the date in javascript?