How to group a specific data inside an array of object given the specific timestamp

Viewed 29
 const getTime = [
    {
      "id": "1a",
      "updated_date": 1663660330000
    }, {
      "id": "2a",
      "updated_date": 1663709646000
    }, {
      "id": "4a",
      "updated_date": 1663779366000
    }, {
      "id": "3a",
      "updated_date": 1663794726000
    }, {
      "id": "5a",
      "updated_date": 1663880166000
    }, {
      "id": "6a",
      "updated_date": 1664121366000
    }]

Given the variable (above), How to group it according to its timestamp. How many data belong to September 20, September 21 and so on.. Note: The expected output should be like this

result = [
  {
    'this should be the exact date{mm/dd/yyy}':[
      {
        "id": "1a",
        "updated_date": 1663660330000
      }, {
        "id": "2a",
        "updated_date": 1663709646000
      }
    ]
  },
  {
    'this should be the exact date{mm/dd/yyy}':[
      {
        "id": "4a",
        "updated_date": 1663779366000
      }, {
        "id": "3a",
        "updated_date": 1663794726000
      },
    ]
  }
]
0 Answers
Related