title: Django compare Datefield in template
body: <p>I am trying to make a Django template page that uses Chart.js. The idea is that it would have fields for the user to add 'From' and 'To' date range to pass to Django template data to fill the Chart.js. </p>
  
  <p>In order for me to figure out how to do that I need to know how to compare dates in Django templates but I can't seem to figure it out, again the below is just a test to figure out how you would compare dates in a template, simplified so I can try the harder parts.</p>
  
  <p>entriesFuel.0.day is equal to March 5, 2020 and is a Django form DateField. I have tried the below</p>
  
  <pre><code>{% if entriesFuel.0.day == "5 March 2020" %}
  &lt;h1&gt;{{entriesFuel.0.day}}&lt;/h1&gt;
  {% else %}
  &lt;h1&gt;{{entriesFuel.1.day}}&lt;/h1&gt;
  {% endif %}
  
  {% if entriesFuel.0.day == "March 5, 2020" %}
  &lt;h1&gt;{{entriesFuel.0.day}}&lt;/h1&gt;
  {% else %}
  &lt;h1&gt;{{entriesFuel.1.day}}&lt;/h1&gt;
  {% endif %}
  
  {% if entriesFuel.0.day == "2020-03-05" %}
  &lt;h1&gt;{{entriesFuel.0.day}}&lt;/h1&gt;
  {% else %}
  &lt;h1&gt;{{entriesFuel.1.day}}&lt;/h1&gt;
  {% endif %}
  </code></pre>
  
  <p>Is it possible to compare the data this way or am I barking up the wrong tree by doing it this way?</p>
  
  <p>Thank you,</p>