function areIntervalsOverlapping(dirtyIntervalLeft, dirtyIntervalRight) {
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  __WEBPACK_IMPORTED_MODULE_1__lib_requiredArgs_index_js__["a" /* default */](2, arguments);
  var intervalLeft = dirtyIntervalLeft || {};
  var intervalRight = dirtyIntervalRight || {};
  var leftStartTime = __WEBPACK_IMPORTED_MODULE_0__toDate_index_js__["a" /* default */](intervalLeft.start).getTime();
  var leftEndTime = __WEBPACK_IMPORTED_MODULE_0__toDate_index_js__["a" /* default */](intervalLeft.end).getTime();
  var rightStartTime = __WEBPACK_IMPORTED_MODULE_0__toDate_index_js__["a" /* default */](intervalRight.start).getTime();
  var rightEndTime = __WEBPACK_IMPORTED_MODULE_0__toDate_index_js__["a" /* default */](intervalRight.end).getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`

  if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) {
    throw new RangeError('Invalid interval');
  }

  if (options.inclusive) {
    return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
  }

  return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
}
@name closestIndexTo
@category Common Helpers
@summary Return an index of the closest date from the array comparing to the given date.

@description
Return an index of the closest date from the array comparing to the given date.

### v2.0.0 breaking changes:

- [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).

- Now, `closestIndexTo` doesn't throw an exception
  when the second argument is not an array, and returns Invalid Date instead.

@param {Date|Number} dateToCompare - the date to compare with
@param {Date[]|Number[]} datesArray - the array to search
@returns {Number} an index of the date closest to the given date
@throws {TypeError} 2 arguments required

@example
// Which date is closer to 6 September 2015?
var dateToCompare = new Date(2015, 8, 6)
var datesArray = [
  new Date(2015, 0, 1),
  new Date(2016, 0, 1),
  new Date(2017, 0, 1)
]
var result = closestIndexTo(dateToCompare, datesArray)
//=> 1