I have this array of objects :
var data = [
  {
    "x": "2020-01-24T10:30:02.000Z",
    "y": 2
  },
  {
    "x": "2020-01-24T08:19:07.000Z",
    "y": 2
  },
  {
    "x": "2020-01-23T16:12:36.000Z",
    "y": 5
  },
  {
    "x": "2020-01-23T08:19:07.000Z",
    "y": 2
  }
]
I'm using ChartJs to display the data in a line chart, I don't know why it does not do this by it self, bu I want to combine the values that only have the same year+month+date without hours the output should be : 
var data = [
  {
    "x": "2020-01-24T00:00:00.000Z",
    "y": 4
  },
  {
    "x": "2020-01-23T00:00:00.000Z",
    "y": 7
  }
]
The code I have so for :
const groupByDate = array => array.reduce((results, item) => {
  const current = results.find(i => new Date(i.x).getDate() === new Date(item.x).getDate());
  if (current) {
    for (let property in item) {
      if (property !== 'x') {
        current[property] = item[property];
      }
    }
  } else {
    results.push({...item});
  }
  return results;
}, []);
console.log(groupByDate(data));
But the function so far does not sum up the y values
 
     
     
     
     
     
    