Created
February 20, 2024 07:54
-
-
Save DavidP1983/3c42ec953b367628bff726d26db21a62 to your computer and use it in GitHub Desktop.
More than 5 minutes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMinut({ from, to }) { | |
const t = Date.parse(to) - Date.parse(from); | |
return Math.floor((t / 1000 / 60) % 60); | |
} | |
function combineMinutes(data) { | |
data.push(data.reduce((prev, curr) => { | |
if (getMinut(curr) > 5) { | |
prev.push(curr); | |
} | |
return prev; | |
}, [])); | |
return data | |
} | |
const result = combineMinutes(dataDB); | |
function getOnlyArrayOfResult(data) { | |
return data.filter(item => { | |
if (Array.isArray(item)) { | |
return item | |
} | |
})[0] | |
} | |
getOnlyArrayOfResult(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment