I have a table on which when the user clicks it generates a line chart for the selected row. The column 0 of the line chart is a string date so I want to format it to Date() in order to apply the DateRange Filter. I do the following
data.yearChart.forEach(row => {
let dato = new Date(row[0]);
if(dato != "Invalid Date" ){
row[0] = dato;
}
console.log(row);
});
In console log I see that all the rows get to be correctly turned to Date object but the chart throws
a.getTime() is not a function. So actually if I add the filter now, it appears correctly but the chart is still not drawn. I also have a Date formatter for the chart but it doesn't seem to do anything.
var formatChart = new google.visualization.DateFormat({formatType: 'short'});
formatChart.format(dataYear, 0);
dateSlider.draw();
chart.draw(dataYear, options);
That's pretty weird since line chart accepts date objects. I would upload more code snippets but the project got pretty chonky at this point and will do it only if needed.
So my question is, how can I make the line chart load with the dates so the date range filter can be applied?
Edit: my json data get loaded on click from php file