title: How to check if one date period overlapping another date period
body: <p>So I have this function I created called <code>isDateOverlapping</code>. It takes in (of all type <code>LocalDate</code>):</p>
  
  <ul>
  <li>Start Date 1</li>
  <li>End Date 1</li>
  <li>Start Date 2</li>
  <li>End Date 2</li>
  </ul>
  
  <p>What this function does is it tells me if the 2 date periods are overlapping or not.</p>
  
  <p>For example if I have 1 period from <code>2019-06-15 to 2019-06-18</code> and another period from <code>2019-06-15 to 2019-06-12</code>. It would return true because the 2 date periods overlap.</p>
  
  <p>However my function doesn't seem to always return the right answer. Could you please help.</p>
  
  <pre><code>public boolean isDateOverlapping(LocalDate start1, LocalDate end1, LocalDate start2, LocalDate end2) {
  
      if (start1.isAfter(start2) &amp;&amp; start2.isBefore(start1)) {
          return true;
  
      } else if (end1.isBefore(end2) &amp;&amp; start1.isAfter(start2)) {
          return true;
      } else if (start1.isAfter(end1) &amp;&amp; end2.isBefore(start2)) {
          return true;
      }
  
      return false;
  
  }
  </code></pre>