I want to serialize from Java to JSON objects Java Calendar and Java Date to Javascript Date.
I want that in Javascript, the variable Javascript Date without having to do the "eval" or "new Date" has a Date value.
I tried to return "new Date (timeInMiliseconds)" but I obtained, obviously a 'String'I. I know I can do "eval" to this "String" but I wan't do it. I have also tried to return "miliseconds" and in "Javascript" call "new Date ()", But I do not want to do that.
The JSON currently looks like
{hours:[
{date:'new Date(1)', color:'fff'},
{date:'new Date(2)', color: 'ddd'},
... ]}
Any suggestions?
Info: I'm using Spring MVC and Jackson to serialize.
Edit#1:
I know this methods:
Java Return ----------------------- Javascript
"new Date(100000)" ------------- var myDate = eval("new Date(100000)");
100000 ------------------------------ var myDate = new Date(10000);
But I'm searching the format that indicate to the client side parsers that the data fragment that was sent is a date representation. But how can you convert it to a JavaScript Date object?
new Date (timeInMiliseconds)?