Home forums Report Bugs issue with AJAX all with DateTime type return Reply To: issue with AJAX all with DateTime type return

#4648

cyoung
Participant

Well, according to jsonlint.com

[{“x”:”\/Date(1370439429173)\/”,”y”:10},{“x”:”\/Date(1370070000000)\/”,”y”:30}]
is valid

[{“x”: new Date(1370439429173),”y”:10},{“x”:new Date(1370070000000),”y”:30}]
is NOT valid
Parse error on line 3:
… { “x”: newDate(137043942917
———————^
Expecting ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{‘, ‘[‘

If I use that string above, AJAX throws a parsererror.

I can put quotes around “new Date” to avoid the parser error. But then nothing is plotted.

Both json strings below give a blank chart.
[{“x”:”Date(1370470421781)”,”y”:10},{“x”:”Date(1370070000000)”,”y”:30}]
[{“x”:”new Date(1370470355535)”,”y”:10},{“x”:”new Date(1370070000000)”,”y”:30}]

Would you please look into this further and make sure that CanvasJS is handling the json object from AJAX properly.

Thanks!