I've scoured the internet for examples but haven't found a suitable one that accomplishes the simple task I need. Maybe you can assist me with it.
Here is an array of objects:
[
{
"date": "2015-01-01T12:00:00.000Z",
"photoUrl": "",
"inProgress": false,
"isCompleted": true,
"size": 1024
},
...
]
I'm seeking a straightforward solution to group these objects by year, then by month, and finally by day in the specified format.
The desired result should be an iterable structure as follows:
[
{
"2015": [
{
"JAN": [
{
"01": { ... },
"02": { ... }
}
],
"FEB": [
{
"01": { ... },
"02": { ... }
}
]
}
],
"2016": [
{
"APR": [
{
"02": { ... }
}
]
}
]
}
]
This transformation will enable easy iteration using ng-repeat in Angular.
If anyone has suggestions, this code could prove useful to others as there are no existing examples of converting a flat array of dates into a structured object of year, month, and day available online.
Thank you very much!