title: Hide markers on Leaflet -or- help filtering results from json url
body: <p>I am using Leaflet to display upcoming open houses on a map from data I receive by fetching JSON from an URL.</p>
  <p>The only value I have to work with is:
  &quot;ACTRIS_OpenHousePublicUpcoming&quot;:&quot;Public: Sun Sep 5, 3:00PM-5:00PM&quot;</p>
  <p>I am able to convert this date to Sep 05 2021 using the following:</p>
  <pre><code>ophouse = ACTRIS_OpenHousePublicUpcoming;    
  const [weekday,month,day,h1,h2] = ophouse.substr(8).split(/[\s,-]+/);
  var d = new Date();
  var n = d.getFullYear();
  var openhousedate = [month,day, n].join(&quot; &quot;);
  var formatted = openhousedate;
  const javaScriptRelease = new Date(formatted);
  const javaScriptRelease2 = new Date(&quot;2021/09/21&quot;);
  </code></pre>
  <p>From here I have tried to hide any marker that is in the past by hiding the <code>.leaflet-marker-icon</code> class.  I added the console log to make sure it was working and every result does come back with the correct log (ie. in the past or upcoming).</p>
  <pre><code> if (javaScriptRelease2 &lt; javaScriptRelease) {
      console.log('open house in the future');
  } else {
      console.log('open house in the past');
      $(&quot;.leaflet-marker-icon&quot;).css(&quot;dislpay&quot;, &quot;none&quot;);
      $(&quot;.leaflet-shadow-pane&quot;).css(&quot;dislpay&quot;, &quot;none&quot;);   
  }
  </code></pre>
  <p>For some reason this is not working. A lot of markers have been hidden if I use</p>
  <pre><code>$(&quot;.leaflet-marker-icon&quot;).css(&quot;opacity&quot;, &quot;0&quot;);
  </code></pre>
  <p>but there are still expired open houses appearing in the results. Also when I zoom all results appear and none are hidden.</p>
  <p>Is there a better way to achieve hiding these markers?</p>
  <p>Here is a JsFiddle of my complete code... it is non-working because I have to hide the api token.  <a href="https://jsfiddle.net/planbjz/2aL0vbju/2/" rel="nofollow noreferrer">https://jsfiddle.net/planbjz/2aL0vbju/2/</a></p>