I have an array with different times registered
const existing = [
{
start: "2020-02-05T09:00:00Z",
end: "2020-02-05T10:15:00Z"
},
{
start: "2020-02-05T10:30:00Z",
end: "2020-02-05T11:00:00Z"
},
{
start: "2020-02-05T11:00:00Z",
end: "2020-02-05T12:15:00Z"
}
]
I want a function that return true or false, if it is possible to add another time.
If 10:00 - 11:00 is registered, it should also be possible to add 09:00-10:00. Meaning that start and end times can overlap.
The user might try to add these hours. But of cause they could choose many other hours
e.g. newStart 09:59 - newEnd 10:20
e.g. newStart 10:16 - newEnd 10:29
The problem is to compare the different objects but also time between the different objects. Any ideas