data = [{
"StartDate": "2018-09-11",
"FunctionID": "276",
"StartTime_EndTime": "08:00:00 AM - 11:00:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "19",
"Item": "Tea Sandwitches and Salads"
}, {
"StartDate": "2018-09-11",
"FunctionID": "276",
"StartTime_EndTime": "08:00:00 AM - 11:00:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "18",
"Item": "Pasta Station"
}, {
"StartDate": "2018-09-12",
"FunctionID": "295",
"StartTime_EndTime": "07:00:00 AM - 07:30:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "1",
"Item": "Tea Sandwitches and Salads"
}, {
"StartDate": "2018-09-12",
"FunctionID": "295",
"StartTime_EndTime": "07:00:00 AM - 07:30:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "26",
"Expr": "18",
"Act_Qty": "19",
"Charge": "9",
"Item": "Coffee"
}, {
"StartDate": "2018-09-13",
"FunctionID": "298",
"StartTime_EndTime": "09:00:00 AM - 11:00:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "19",
"Item": "Tea Sandwitches and Salads"
}, {
"StartDate": "2018-09-13",
"FunctionID": "298",
"StartTime_EndTime": "07:00:00 AM - 11:00:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "18",
"Item": "Pasta Station"
}, {
"StartDate": "2018-09-15",
"FunctionID": "299",
"StartTime_EndTime": "06:00:00 AM - 07:30:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "13",
"Expr": "12",
"Act_Qty": "13",
"Charge": "1",
"Item": "Tea Sandwitches and Salads"
}, {
"StartDate": "2018-09-16",
"FunctionID": "299",
"StartTime_EndTime": "06:30:00 AM - 07:30:00 AM",
"ResDesc": "Breakfast",
"functionRoom": "Living Room",
"Gurenteed": "26",
"Expr": "18",
"Act_Qty": "19",
"Charge": "9",
"Item": "Coffee"
}];
var byStartDate = _.groupBy(data, 'StartDate');
_.each(byStartDate, (d, i) => {
byStartDate[i] = _.groupBy(d, 'FunctionID');
_.each(byStartDate[i], (d1, i1) => {
byStartDate[i][i1] = _.groupBy(d1, d2 => {
return d2["StartTime_EndTime"].split("-")[0].trim();
});
});
});
console.log(byStartDate);
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"></script>