title: Javascript filtering between dates to get records in specific date range
body: <p>I am making an API call that returns a large set of data. From that data I want to filter out and get only the records with a due date greater then or equal to today and less then or equal to 30 days from now.</p>
  <p>But my filter is returning an incorrect set of records.</p>
  <pre><code>addDays = (date, days) =&gt; {
          var result = new Date(date);
          result.setDate(result.getDate() + days);
          return result;
      }
  
  let today = new Intl.DateTimeFormat('en-US').format(new Date()); //returns &quot;07/31/2020&quot; as expected
  let add30 = new Intl.DateTimeFormat('en-US').format(this.addDays(today, 30)); //returns &quot;08/30/2020 as expected
  
  let dueInThirtyDays = allActivities.filter(activity =&gt; new Intl.DateTimeFormat('en-US').format(new Date(activity.dueDate)) &gt;= today &amp;&amp; new Intl.DateTimeFormat('en-US').format(new Date(activity.dueDate)) &lt;= add30 &amp;&amp; new Intl.DateTimeFormat('en-US').format(new Date(activity.closedDate) === null));
  
  
  //where format of activity.dueDate = &quot;2020-01-14&quot; which is whay its wrapped in the DateTimeFormat method
  
  </code></pre>
  <p>EXAMPLE of the array of Objects I am filtering through:</p>
  <pre><code>{
  typeCode: &quot;BCA &quot;
  categoryCode: &quot;PN &quot;
  activityDescription: &quot;PNACT03 TIER2 PRIMARY&quot;
  effectiveDate: &quot;2010-10-14&quot;
  statusDate(pin): null
  closedDate(pin): &quot;2012-06-30&quot;
  dueDate(pin): &quot;2011-01-14&quot;
  }
  
  </code></pre>
  <p>I am noticing that the format string return a date that is one day before the date given but I'm getting results back that are months ad years before today and well after 30 days from today.
  Its also return results where <code>closedDate</code> is not null</p>