How to print Issues that are sorted by due date?

This article will show you an example of how to print Issues that are sorted by the due date.

<h4>Ascending sort</h4>
{% assign issues_by_due_date = issues.all | sort: "due_date" %}
<table>
<tr><th>id</th><th>subject</th><th>due_date</th></tr>
{% for issue in issues_by_due_date %}
  <tr>
    <td>{{ issue.id }}</td>
    <td>{{ issue.subject }}</td>
    <td>{{ issue.due_date }}</td>
  </tr>
{% endfor %}
</table>

<br>

<h4>Descending sort</h4>
{% assign issues_by_due_date = issues.all | sort: "due_date" | reverse %}
<table>
<tr><th>id</th><th>subject</th><th>due_date</th></tr>
{% for issue in issues_by_due_date %}
  <tr>
    <td>{{ issue.id }}</td>
    <td>{{ issue.subject }}</td>
    <td>{{ issue.due_date }}</td>
  </tr>
{% endfor %}
</table>

And the result is:

issues_printed_due_date.png

Video demonstration

Was this article helpful? Yes  No
74 from 104 found this helpful