i have an array of object. every object has a date. I want to create a new array of object, grouping by weeks. here is some code example:
const data = [
  {
    "id": 1,
    "status": 1,
    "createdAt": "2022-05-01T08:28:36.284Z"
  },
  {
    "id": 2,
    "status": 2,
    "createdAt": "2022-05-02T07:17:11.724Z"
  },
  {
    "id": 3,
    "status": 3,
    "createdAt": "2022-05-10T07:03:44.465Z"
  },
  {
    "id": 4,
    "status": 3,
    "createdAt": "2022-05-11T16:17:48.863Z"
  }
]
The result I want Is an array that divides object by weeks like:
const newData = [
  {
    "week": 1,
    "status": 1,
    "status": 2
  },
  {
    "week": 2,
    "status": 3,
    "status": 3
  }]
is it possible? can I have same property 2 times in the same object? thank you