Calculate the intersections of opening hours
calculate is not reusable. It's hardcoded to always use filteredTimes. It's also putting its results to an array on the outside. Strive for pure functions as much as possible, like math equations. It keeps them reusable, testable and deterministic.
Your variable names are vague. A good sign that you're not naming things well enough is when you have to explain to another developer what it is (like what you're doing in the comments). Never be afraid to name things verbosely.
You might not need moment.js. What you're doing with moment.js is just intermediary conversion of formats - an unnecessary procedure. When operating with dates and times, it's best to have your data in a format that doesn't need intermediate conversions.


Now simply put, what you're essentially looking for "windows" where the given times overlap. Here's a modified version of your code. The modifications include:


The times are all numbers. You don't really need to have the HH:mm format in this operation. If you strip off the : from the time, they're effectively numbers from 0000 to 2359` (with the last 40 mins in each hour missing). This eliminates the need for moment.js.
Nested array.forEach(), because for loops are also clunky (you have to keep indexes, do length comparisons, etc.). Plus you're using array.forEach() already anyways.
I stored results in an object keyed by the combination of from and to. This way, the lookup doesn't require a very clunky array.find(). Converting it to an array is as simple as iterating over the keys and mapping them to the values.
computeWindows is now a pure-ish function. You can now call it anytime, anywhere with any input, and always get a deterministic-ish output (Object.keys() do not guarantee the order of keys, so while the items may be the same, the order may be different by browser).




const ranges = [{
  from: 1000,
  to: 1100
}, {
  from: 1015,
  to: 1115
}, {
  from: 1030,
  to: 1130
}, {
  from: 1045,
  to: 1145
}, {
  from: 1100,
  to: 1200
}]

const isBetween = (value, start, end) =&gt; value &gt; start &amp;&amp; value &lt; end

const computeWindows = ranges =&gt; {
  const index = {}
  
  ranges.forEach(({ from: rFrom, to: rTo }) =&gt; {  
    ranges.forEach(({ from: cFrom, to: cTo }) =&gt; {
      // The actual logic
      rFrom = isBetween(cFrom, rFrom, rTo) &amp;&amp; cFrom &gt; rFrom ? cFrom : rFrom
      rTo = isBetween(cTo, rFrom, rTo) &amp;&amp; cTo &lt; rTo ? cTo : rTo
    })
    
    // Construct the key and value
    const key = `${rFrom}-${rTo}`    
    const value = { from: rFrom, to: rTo }
    
    // Use existing value of key or add new value to key.
    index[key] = index[key] || value
  })

  // Convert results into an array of ranges.
  return Object.keys(index).map(k =&gt; index[k])
}

console.log(computeWindows(ranges))