I am using moment.js, i have this kind of data in my Array/Object.
[{"start_datetime":"05/18/2021 1:30pm","end_datetime":"05/18/2021 2:00pm"},
{"start_datetime":"05/18/2021 2:00pm","end_datetime":"05/18/2021 3:30pm"},
{"start_datetime":"05/18/2021 1:30pm","end_datetime":"05/18/2021 3:30pm"}]
I wanted to create a function that will read through this array and check if there's a value that is between the values in the array.
Example: The first key which is {"start_datetime":"05/18/2021 1:30pm","end_datetime":"05/18/2021 2:00pm"} is between the last key which is {"start_datetime":"05/18/2021 1:30pm","end_datetime":"05/18/2021 3:30pm"}
I am aware that we can use moment's isBetween function, but I am thinking on the most efficient way of looping all the values in the array.
Thanks in advance!