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.
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.
entriesFuel.0.day is equal to March 5, 2020 and is a Django form DateField. I have tried the below
{% if entriesFuel.0.day == "5 March 2020" %}
<h1>{{entriesFuel.0.day}}</h1>
{% else %}
<h1>{{entriesFuel.1.day}}</h1>
{% endif %}
{% if entriesFuel.0.day == "March 5, 2020" %}
<h1>{{entriesFuel.0.day}}</h1>
{% else %}
<h1>{{entriesFuel.1.day}}</h1>
{% endif %}
{% if entriesFuel.0.day == "2020-03-05" %}
<h1>{{entriesFuel.0.day}}</h1>
{% else %}
<h1>{{entriesFuel.1.day}}</h1>
{% endif %}
Is it possible to compare the data this way or am I barking up the wrong tree by doing it this way?
Thank you,