Gant chart passes time in milliseconds to MVC4 controller. Code below prints out 1440190800000
$(".gantt").gantt({
onAddClick: function (dt, rowId) {
alert(dt);
window.location.href='NewBooking?' + $.param({
datetime: dt,
row: rowId
});
},
MVC4 controller has signature:
public ActionResult NewBooking(DateTime datetime, string row)
{
var m = new NewBookingViewModel();
return View(m);
}
Calling this controller causes error
The parameters dictionary contains a null entry for parameter 'datetime' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult NewBooking(System.DateTime, System.String)' in 'Eeva.Erp.Controllers.BookingController'. An optional parameter must be a
since milliseconds are not contverted to datetime.
How to fix this in controller code or in javascript to get DateTime value ?