Структурные данные в JavaScript
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);
}
Muddy Meerkat