📅  最后修改于: 2022-03-11 15:04:09.751000             🧑  作者: Mango
var item,
i = 0,
groups = {},
year, day;
while (item = eventsArray[i++]) {
item = new Date(item.date);
year = item.getFullYear();
day = item.getDate();
groups[year] || (groups[year] = {}); // exists OR create {}
groups[year][day] || (groups[year][day] = []); // exists OR create []
groups[year][day].push(item);
}