I have this controller method that returns a JSON
public JsonResult InactiveUsers(int nbrOfInactiveDays)
{
var results = FetchInactiveUsers(nbrOfInactiveDays);
return Json(results, JsonRequestBehavior.AllowGet);
}
the content of the result is a collection of object, where the object is defines like this
[DataContract]
public class Inactive
{
[DataMember]
public int UserID { get; set; }
[DataMember]
public string FullName { get; set; }
[DataMember]
public DateTime LastLoginDate { get; set; }
}
I already debugged to check the all the content and the LastLoginDate
property and they all contains the date in this format {5/17/2014 12:43:55 AM}
. But when I passed this back and do a console.log on the success call back of my ajax request the date of the first object is invalid
$.ajax({
type: "POST",
url: "/User/InactiveUsers/",
cache: false,
traditional: true,
dataType: "json",
data: args,
success: function (results) {
console.log(results);
the content of the console.log shows that the LastLoginDate
property of the first item is invalid
While the rest of the date is displayed as milli-seconds and is correct.
Just wondering what could have happened? The date time in millisecond is desirable because of the widget that I am using to display the data.