Commit 42119c6a by Brian Talbot Committed by Stephen Sanchez

adding 'time until' copy into due date UI

parent 0a357651
......@@ -12,7 +12,12 @@
<span class="wrapper--copy">
<span class="step__label">Assess Peers</span>
{% if peer_due %}
<span class="step__deadline">due <span class="date">{{ peer_due }}</span></span>
<span class="step__deadline">due
<span class="date">
{{ peer_due }}
(in {{ peer_due|timeuntil }})
</span>
</span>
{% endif %}
</span>
</h2>
......
......@@ -13,7 +13,12 @@
<span class="wrapper--copy">
<span class="step__label">Assess Yourself</span>
{% if self_due %}
<span class="step__deadline">due <span class="date">{{ self_due }}</span></span>
<span class="step__deadline">due
<span class="date">
{{ self_due }}
(in {{ self_due|timeuntil }})
</span>
</span>
{% endif %}
</span>
</h2>
......
......@@ -380,25 +380,20 @@ class OpenAssessmentBlock(
context = Context(context_dict)
return Response(template.render(context), content_type='application/html', charset='UTF-8')
def format_date_string(self, date):
"""Takes a date string, and formats it to be a user facing date.
Format a date string to be user facing.
"""
return dateutil.parser.parse(
unicode(date)
).replace(tzinfo=pytz.utc).strftime(DATE_FORMAT)
def format_datetime_string(self, datetime):
"""Takes a datetime string, and formats it to be a user facing time.
Format a datetime string to be user facing.
Args:
datetime (str): A ISO formatted Datetime String, to be converted to
a datetime object with UTC timezone.
Returns:
datetime with UTC timezone from the given string.
"""
return dateutil.parser.parse(
unicode(datetime)
).replace(tzinfo=pytz.utc).strftime(DATETIME_FORMAT)
return dateutil.parser.parse(unicode(datetime)).replace(tzinfo=pytz.utc)
def add_xml_to_node(self, node):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment