Commit 30435c46 authored by svilayphiou's avatar svilayphiou
Browse files

Managing date formatting for commit lists and last_activity_at and

created_at (the latter two were already date objects)
parent fe1ee806
......@@ -12,10 +12,12 @@ env = Environment(
loader=FileSystemLoader(TEMPLATE_DIR),
autoescape=select_autoescape(['html', 'xml'])
)
STRPTIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
def format_datetime(value, format="%d/%m/%Y, %H:%M"):
date = datetime.datetime.strptime(value[:-10], STRPTIME_FORMAT)
return date.strftime(format)
if (type(value) == str):
value = datetime.datetime.strptime(value[:-10], STRPTIME_FORMAT)
return value.strftime(format)
env.filters['datetime'] = format_datetime
......
......@@ -5,8 +5,8 @@
{% for project in projects %}
<li class="repo {% if project.default_branch == "archive" %}archived{% endif %}">
<a href="{{ project.links.self }}">{{ project.name }}</a>
<p class="repo--latest-commit">Last updated on {{ project.last_activity_at }}
<p class="repo--start">{{ project.commits|length }} commits since {{ project.created_at }}</p>
<p class="repo--latest-commit">Last updated on {{ project.last_activity_at|datetime("%d/%m/%Y at %H:%M") }}
<p class="repo--start">{{ project.commits|length }} commits since {{ project.created_at|datetime("%d/%m/%Y") }}</p>
</li>
{% endfor %}
</ul>
......
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