I got an array from a CMS that is poorly formatted which I want to reformat to an array of objects.
let daysOffArray = ["2022-08-22, 08:00 - 14:00","2022-08-23, 08:00 - 13:00"];
Expected result after separating the array:
let daysOff = [{
date: "2022-08-22",
time: 08:00 - 14:00
},
{
date: "2022-08-23",
time: 08:00 - 13:00
}];
How can I separate the array daysOffArray for each second comma and then separate the two new arrays after each comma?