Currently, the array is structured as follows:
array = [
{
date: '2020/06/12',
hours: 8.4
},
{
date: '2020/06/15',
hours: 4.5
},
{
date: '2020/06/12',
hours: 3.8
},
{
date: '2020/06/16',
hours: 5.5
},
]
The objective is to combine and filter out duplicated dates in order to sum their corresponding hours. For example, with the given array above where the day 12 occurs twice, the result should be as follows:
array = [
{
date: '2020/06/12',
hours: 12.2
},
{
date: '2020/06/15',
hours: 4.5
},
{
date: '2020/06/16',
hours: 5.5
},
]