title: Javascript FullCalendar highlight dates in array
body: <p>This is based on a previous question here that seem to be unanswered: <a href="https://stackoverflow.com/questions/26613088/fullcalendar-select-all-dates-in-array-list">FullCalendar select all dates in array/list?</a></p>
  <p>I will be using nodejs to get data coming through for specific dates, and I need to select those dates on the FullCalendar in an array.  Unfortunately the dates in the array are not highlighting and I am not sure why.</p>
  <pre><code>$(document).ready(function() {
    $('#calendar').fullCalendar({});
  
      var dates = [&quot;2021-10-20&quot;, &quot;2021-10-21&quot;];
  
          
      $('.fc-day').each(function () {
          var thisdate = $(this).attr('data-date');
          var td = $(this).closest('td');
  
          if ($.inArray($(this).attr('data-date'), dates) !== -1) {
              td.addClass('fc-state-highlight');
          } else {
              td.removeClass('fc-state-highlight');
          }
      });
    
  });
  </code></pre>
  <p><a href="https://jsfiddle.net/kpsy1tuw/#" rel="nofollow noreferrer">https://jsfiddle.net/kpsy1tuw/#</a></p>