I have an array with a bunch of objects in it. The 'endTime' value of one object is sometimes greater than the 'endTime' value of the previous one. I have added an example of this within the second object in the array.
[
{
title: 'Title 1',
startTime: '2019-09-26T06:00:00+0100',
endTime: '2019-09-26T08:30:00+0100'
},
{
title: 'Title 2',
startTime: '2019-09-26T08:00:00+0100',
endTime: '2019-09-26T08:15:00+0100'
},
{
title: 'Title 3',
startTime: '2019-09-26T08:30:00+0100',
endTime: '2019-09-26T09:25:00+0100'
},
{
title: 'Title 4',
startTime: '2019-09-26T09:25:00+0100',
endTime: '2019-09-26T10:25:00+0100'
},
{
title: 'Title 5',
startTime: '2019-09-26T10:25:00+0100',
endTime: '2019-09-26T11:00:00+0100'
}
]
The 'endTime' should aways be chronological and '8:15' should never come after '8:30' in the array. I'm looking to do a check for whenever 'endTime' value is less than it's previous and then remove it from the array. Any help would be appreciated. Thanks