I have a date in my DB of 2014-03-03 05:00:00, which is being rendered in JSON as:
the date is /Date{(-6xxxxx)/ and I call this method to parse it:
function parseJsonDate(dateString) {
var result = new Date(+dateString.replace(/\/Date\((-?\d+)\)\//gi, "$1"));
var result = new Date(parseInt(dateString.replace('/Date(', '')));
result.format("dd-MM-yyyy");
return result;
}
when running, i comment out one of the results lines, but get the same result for both:
the method is being called from Jquery template like such:
<tr>
<td>
<span id="approvedDate"><i class="glyphicon glyphicon-time" data-toggle="tooltip"
data-original-title="approved date"></i> ${parseJsonDate(AuditDate)}</span>
</td>
</tr>
EDIT
What a muppet.. I spent so long thinking this was a JSON vconversion issue, i totally forgot to go back and check my dapper code. my ApprovalHistory objec had AuditDate, but I was asking for EnteredDate in the sql. So, it was doing as expected.
aaaaaaaarrr :-)