title: TimePeriodLibrary Intersect two time periods
body: <p>I have been fighting against the TimePeriodLibrary for the past few hours already. I simply want to compare two time periods in order to determine their intersection...</p>
  
  <p>According to <a href="https://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET" rel="nofollow noreferrer">codeproject</a> it seems that TimePeriodLibrary offers this capability.</p>
  
  <p>In my case I use the very simple code below:</p>
  
  <pre><code>public ICollection&lt;TimeRange&gt; Extract(TimeRange range, TimeSpan? maxDuration = null)
  {
      (...)
      var res = _source.IntersectionPeriods(range);
      (...)
  }
  </code></pre>
  
  <p>With source being an instance of type <code>TimePeriodCollection</code></p>
  
  <p>When :</p>
  
  <ul>
  <li>_source is a period starting from 6/3/2018 12:00:00 PM to 6/3/2021 1:00:00 PM</li>
  <li>range is a period starting from 30/3/2018 12:00:00 AM to 31/3/2018 12:00:00 AM</li>
  <li><strong>Outcome</strong>: the intersection contains everything from _source </li>
  <li><strong>Expected</strong>: period starting from 30/3/2018 12:00:00 AM to 31/3/2018 12:00:00</li>
  </ul>
  
  <p>What am I missing?</p>