1-401-612-6440 info@rwblackburn.com

For over a week now I have been struggling with a rather tricky formatting issue with Google Visualization API. My server side code which was generating the JSON needed to put Date objects into a string format to be compatible with jQuery’s AJAX parsing. However the example code from Google uses Date objects in the JSON, such as this:

 new Date(2008, 1 ,1)

Take a look at the Annotation Time Line for an example.

After killing myself for days, I finally found this note in Google’s documentation:

JSON does not support JavaScript Date values (for example, "new Date(2008,1,28,0,31,26)"; the API implementation does. However, the API does now support a custom valid JSON representation of dates as a string in the following format: Date(year, month, day[,hour, minute, second[, millisecond]]) where everything after day is optional, and months are zero-based.

This was huge, and worked great. However I lost so much time before finding this (I will not even share some of the ludicrous “work around” solutions I had concocted) I felt competed to share this little foot note with everyone in case someone else found themselves with the same issue.