diff --git a/analysis/render_report.py b/analysis/render_report.py index e786df4..70a587c 100644 --- a/analysis/render_report.py +++ b/analysis/render_report.py @@ -58,14 +58,9 @@ def b64encode(path): return f"data:{mtype};base64, {encoded}" -def date_format(date): - """Formats the given date as, for example, "1 January 2023".""" - return f"{date:%-d %B %Y}" # the - removes the leading zero, but not on Windows - - # register template filters ENVIRONMENT.filters["b64encode"] = b64encode -ENVIRONMENT.filters["date_format"] = date_format +ENVIRONMENT.filters["date_format"] = utils.date_format def render_report(data): diff --git a/analysis/utils.py b/analysis/utils.py index 2daf557..e9d2729 100644 --- a/analysis/utils.py +++ b/analysis/utils.py @@ -27,3 +27,8 @@ def slugify(s): # remove leading and trailing dashes and underscores s = s.strip("-_") return s.lower() + + +def date_format(date): + """Formats the given date as, for example, "1 January 2023".""" + return f"{date:%-d %B %Y}" # the - removes the leading zero, but not on Windows