title: Getting max date in Jinja template
body: <p>I have the following template:</p>
  
  <pre><code>{% block begin_content scoped %}
      &lt;div class="table-responsive"&gt;
      &lt;table class="table table-bordered table-hover"&gt;
  {% endblock %}
  {% block begin_loop_values %}
      {% if actions %}
          &lt;th&gt;Diagnosis&lt;/th&gt;
          &lt;th&gt;MRN&lt;/th&gt;
          &lt;th&gt;Max Dx Date&lt;/th&gt;
  
      {% endif %}
      {% for item in value_columns %}
  
          {% for dx in value_columns | groupby('dx_code') %}
              {% for person in group.list | groupby('mrn') %}
                  &lt;div class="table-responsive"&gt;
  
                      &lt;td&gt;{{ dx.grouper }}&lt;/td&gt;
                      &lt;td&gt;{{ person.grouper }}&lt;/td&gt;
  
                 &lt;/div&gt;
              {% endfor %}
          {% endfor %}
  
  
      {% endfor %}
  
  {% endblock %}
  
  {% block end_content scoped %}
  &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>{% endblock %}</p>
  
  <p>Where I am grouping data that look like:</p>
  
  <pre><code>{'dx_code': u'1234', 'mrn': u'12345678', 'dx_date': u'1/28/2015'}
  
  {'dx_code': u'1234', 'mrn': u'12345678', 'dx_date': u'1/28/2014'}
  
  {'dx_code': u'1234', 'mrn': u'12345678', 'dx_date': u'1/28/2013'}
  
  {'dx_code': u'1234', 'mrn': u'12345678', 'dx_date': u'1/28/2012'}
  
  {'dx_code': u'1234', 'mrn': u'12345678', 'dx_date': u'1/28/2011'}
  </code></pre>
  
  <p>That works great, but now I need to get the MAX <code>dx_date</code> somehow and print it with the grouped data in my template. I am assuming I need to insert a jQuery function to do this - something like </p>
  
  <pre><code>&lt;script language="javascript"&gt;
      var latest = new Date(Math.max.apply(null, dx.dx_date));
  &lt;/script&gt;
  </code></pre>
  
  <p>, but am not sure how to get it's value into my template?</p>