On MVC side I have a class like this:
public class ComplexOne
{
public DateTime Date {get;set;}
public int Value {get;set;}
}
And in controller action
public virtual JsonResult TakeData(int id, ComplexOne[] data)
From JS I'm sending object like this:
{
id = 10,
data = [
{Date:"2017-12-27", Value:10},
{Date:"2017-12-27", Value:20},
{Date:"2017-12-27", Value:30}
]
}
MVC understands all except Date, which deserializes as default value ({01.01.0001 0:00:00}). I've tried different date formats - yyyy-MM-dd, dd-MM-yyyy, MM/dd/yyyy and even ISO one, but got no luck.
How to do this in correct way without passing date as string and manual parsing in MVC?
{Date: new DateTime(2015,06,27), Value: 10}