In JS, given an array of objects, like:
[{
date: 1525655429184,
value: 20.00
},{
date: 1525655429184,
value: 3.99
},{
date: 1526001029184,
value: 19.00
},{
date: 1526001025184,
value: 4.30
}]
Where the 'date' property is a date in milliseconds, and the 'value' property is a monetary represented by a float, and each object of this array can be one day of the month with his associated value.
I want to get the sum of value for each week day, to show in a chart of total values x day.
So the output should be like this example:
[
{ day: 'Sun', sum: 23.99 },
{ day: 'Mon', sum: 0 },
{ day: 'Tue', sum: 22.2 },
{ day: 'Wed', sum: 22.3 },
{ day: 'Thu', sum: 2.2 },
{ day: 'Fri', sum: 32.2 },
{ day: 'Sat', sum: 22.43 },
]