let temp = ['00:00-23:59']
// temp.forEach(e => {
// let t = e.split('-')
// if (startTime >= t[0] && endTime <= t[1]) {
// let res = [t[0], startTime, endTime, t[1]]
// console.log(res)
// return res
// }
// })
function checkTimeRank(arr, value) {
let [startTime, endTime] = value
let res
arr.forEach((e, i) => {
let t = e.split('-')
if (startTime >= t[0] && endTime <= t[1]) {
res = [`${t[0]}-${startTime}`, `${endTime}-${t[1]}`]
arr.splice(i, 1, ...res)
return false
}
})
}
checkTimeRank(temp, ['09:00', '18:00'])
checkTimeRank(temp, ['06:00', '08:00'])
checkTimeRank(temp, ['17:00', '22:00'])
console.log(temp)
console