diff --git a/ietf/idtracker/templatetags/ietf_filters.py b/ietf/idtracker/templatetags/ietf_filters.py index b93ada28f..18f2a4106 100644 --- a/ietf/idtracker/templatetags/ietf_filters.py +++ b/ietf/idtracker/templatetags/ietf_filters.py @@ -7,6 +7,7 @@ try: except ImportError: from email import Utils as emailutils import re +import datetime #from ietf.utils import log register = template.Library() @@ -155,3 +156,17 @@ def rfcnospace(string): def lstripw(string, chars): """Strip matching leading characters from words in string""" return " ".join([word.lstrip(chars) for word in string.split()]) + +@register.filter(name='thisyear') +def thisyear(date): + """Returns a boolean of whether or not the argument is this year.""" + if date: + return date.year == datetime.date.today().year + return True + +@register.filter(name='inpast') +def inpast(date): + """Returns a boolean of whether or not the argument is in the past.""" + if date: + return date < datetime.datetime.now() + return True diff --git a/ietf/templates/idtracker/document_entry.html b/ietf/templates/idtracker/document_entry.html index 73fdb9b3e..a5dc969e9 100644 --- a/ietf/templates/idtracker/document_entry.html +++ b/ietf/templates/idtracker/document_entry.html @@ -4,11 +4,11 @@ {% ifequal doc.cur_state.state "In Last Call" %} {% if doc.document.lc_expiration_date %} - {{ doc.document.lc_expiration_date }} + {{ doc.document.lc_expiration_date|date:"M j" }}{% if not doc.lc_expiration_date|thisyear %}, {{ doc.lc_expiration_date|date:"Y" }}{% endif %} {% endif %} {% else %} {% if doc.status_date %} - {{ doc.status_date|date:"M j" }} + {{ doc.status_date|date:"M j" }}{% if not doc.status_date|thisyear %}, {{ doc.status_date|date:"Y" }}{% endif %} {% endif %} {% endifequal %} {% else %}