title: List dates defined by a set of rules
body: <p>I'm needing to create a form where the user can input a set of rules, and have returned a list of dates that match these rules.</p>
  
  <p>For example:</p>
  
  <p>'First day in December this year' => 2020-12-01
  'First Monday in May this year' => 2020-05-04</p>
  
  <p>I have managed to achieve this by using DateTime and giving it a relative date:</p>
  
  <pre><code>$ordinal = 'first';
  $unit = 'day';
  $month = 'december';
  
  $date = new DateTime($ordinal . ' ' . $unit . ' of ' . $month . ' this year' );
  </code></pre>
  
  <p>The ordinal, unit and month are currently being selected by dropdown menus on the front-end.</p>
  
  <p>The issue I'm facing is when multiple dates could match the rules. For example:</p>
  
  <p>'The first weekend in December this year' should return 2020-12-05 &amp; 2020-12-06.
  'Every weekend in march' should return the date of each Saturday and Sunday during March.</p>
  
  <p>The method I used for single dates obviously does not work. When changing my <code>unit</code> to 'weekend', I get the following error message:</p>
  
  <p><code>Fatal error: Uncaught Error: DateInterval::__construct() expects exactly 1 parameter, 0 given</code></p>
  
  <p>I've had a look at DateInterval, but doubtful this is what I need. Any help would be appreciated.</p>