I want to transform this data set:
[
{
"id": 470830,
"input": "MANUAL",
"value": 10000,
"date": "2019-09-23T08:01:09.976Z"
},
{
"id": 435258,
"input": "AUTO",
"value": 20000,
"date": "2019-09-23T10:01:09.976Z"
},
{
"id": 435207,
"input": "MANUAL",
"value": 5000,
"date": "2019-09-24T12:01:09.976Z"
},
{
"id": 435208,
"input": "AUTO",
"value": 15000,
"date": "2019-09-24T14:01:09.976Z"
}
]
to this
[
{
"date": "2019-09-23"
"total": 30000,
"manual": 10000,
"auto": 20000,
},
{
"date": "2019-09-24"
"total": 20000,
"manual": 5000,
"auto": 15000,
}
]
Objects are grouped by date (not DateTime) and remapped to have value
props from AUTO and MANUAL + the sum of these.
What is the most efficient way to do this with JavaScript?
--- EDIT ---
Removed id
on transformed object as a comment suggests