Hi Vincent, We have tried to unify the various ways of setting up DataTables, but there have been changes in how dates are handled recently, and it appears likely the case you found has been either broken, or always was broken.
Can you can use new Data(...) without quotes? JSON notation doesn't allow new Date() constructors, so that is why the "Date(...)" format is supported at least there. When you use JSON.parse() you are just turning the string into an anonymous JS object, so if you can use the anonymous JS object instead, with new Date() constructors, that would be the simplest workaround. On Mon, Oct 10, 2016 at 6:10 AM, Vincent Holland-Keen < vincent.hk...@gmail.com> wrote: > Hi, > > I've been struggling for days to get dates working with a chart and have > finally come to the (possibly erroneous) conclusion that there's a > difference between the implementation of dates in the DataTable function > and in the addRows function. > > This JSFiddle hopefully shows what I mean: https://jsfiddle.net/ > fiskerton/vc4o0710/1/ > > If a DataTable is created with both columns and rows, passing in a > JSON.parse'd string with a date value in the format 'Date(YYYY,MM,DD)' > works fine. If that same format is passed to addRows, the console throws > the error: 'Uncaught Error: Type mismatch. Value Date(YYYY,MM,DD) does not > match type date in column index 1. I haven't found any other format that > successfully takes a string containing a date and gets it to work with > addRows - e.g. 'new Date(YYYY,MM,DD' fails with same error. > > Is there something I've missed? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-visualization-api+unsubscr...@googlegroups.com. > To post to this group, send email to google-visualization-api@ > googlegroups.com. > Visit this group at https://groups.google.com/ > group/google-visualization-api. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-visualization-api/6294cb99-9812-471b-87fc- > 7b040a6972c2%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/6294cb99-9812-471b-87fc-7b040a6972c2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> dlalibe...@google.com <dlalibe...@google.com> 5CC, Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com. To post to this group, send email to google-visualization-api@googlegroups.com. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPwbaFF2cjPdqWefrdn7FFfbYFHSTp%3DQZMHa%2Bx7hGNr3g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.