From 6e710b77248f6e6ee57cdd578607d900b18af810 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 26 2014 08:19:26 +0000 Subject: Add a humanize filter to humanize dates in the templates Signed-off-by: Pierre-Yves Chibon --- diff --git a/progit/__init__.py b/progit/__init__.py index 8e5bd5f..b852f77 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -135,6 +135,13 @@ def lastcommit_date_filter(repo): return arrow.get(commit.commit_time).humanize() +@APP.template_filter('humanize') +def humanize_date(date): + """ Template filter returning the last commit date of the provided repo. + """ + return arrow.get(date).humanize() + + @APP.template_filter('rst2html') def rst2html(rst_string): """ Template filter transforming rst text into html