1

I'm using react-google-charts to create a Timeline. It works for me on my Macbook but not on iPad or iPhone with Chrome. It doesn't work in Safari or Firefox on the Macbook.

This is the error message I get: undefined is not an object (evaluating 'Dygraph.TICK_PLACEMENT[a].datefield')×

I've looked through the Google Developers forum but couldn't find any similar posts. Any idea what this means?

GitHub repo

In the console in Safari, it says invalid date. So I need to fix the format of the dates I think.

smabbett
  • 21
  • 4

1 Answers1

1

I figured it out. It was the date format. The csv file I was pulling from used a date format '16JUL2016'. I was using that to create a new Date, i.e. new Date('16JUL2016'). That was not working in all browsers. So I used slice to get the month, date and year and create a new date.

    let startDay = startDate.slice(0, 2);
    let startMonth = months.findIndex((e) => e === startDate.slice(2, 5));
    let startYear = startDate.slice(5);

    let start = new Date(startYear, startMonth, startDay, 0, 0, 0);
smabbett
  • 21
  • 4