Skip to content

Instantly share code, notes, and snippets.

@DavidP1983
Created February 20, 2024 07:54
Show Gist options
  • Save DavidP1983/3c42ec953b367628bff726d26db21a62 to your computer and use it in GitHub Desktop.
Save DavidP1983/3c42ec953b367628bff726d26db21a62 to your computer and use it in GitHub Desktop.
More than 5 minutes
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