Open this example in the interactive library
Source code
const duration = (start, end) => (end - start + 1440) % 1440;
console.log(duration(22 * 60, 6 * 60));
Sample output
480

Open this example in the interactive library
const duration = (start, end) => (end - start + 1440) % 1440;
console.log(duration(22 * 60, 6 * 60));
480