Используя момент и loda sh, вы можете добиться этого с помощью этого кода:
var moment = require('moment')
var _ = require('lodash')
var dates = [{text: "b", len: 1, Date: "Fri May 01 2020 10:49:01 GMT+0100 (West Africa Standard Time)", Source: "Twitter for Android", Likes: 1}, {text: "b", len: 1, Date: "Fri May 01 2020 10:50:03 GMT+0100 (West Africa Standard Time)", Likes: 1}, {text: "b", len: 1, Date: "Fri May 02 2020 10:55:03 GMT+0100 (West Africa Standard Time)",Likes: 4}, {text: "b", len: 1, Date: "Fri May 02 2020 10:56:03 GMT+0100 (West Africa Standard Time)",Likes: 3}, {text: "b they will neither comment not like this tweet", len: 47, Date: "Fri May 01 2020 11:35:49 GMT+0100 (West Africa Standard Time)", Likes: 0}];
var datesFormatted = dates.map(d => ({ date: moment(new Date(d.Date)).format("MMM DD YYYY"), likes: d.Likes }));
const result = _(datesFormatted)
.groupBy('date')
.map((dateValue, date) => ({
date: date,
likes: _.sumBy(dateValue, "likes")
}))
.value()
console.log(result)
Результат выглядит так:
[ { date: 'May 01 2020', likes: 2 },
{ date: 'May 02 2020', likes: 7 } ]