diff --git a/make_html.py b/make_html.py index 9e3e29848..075fe3b0e 100644 --- a/make_html.py +++ b/make_html.py @@ -9,7 +9,6 @@ from collections import defaultdict from flask import Flask, render_template, abort, Response, send_from_directory -import pytz import licenses import timeliness @@ -20,7 +19,7 @@ import humanitarian from vars import expected_versions import text -from datetime import datetime +from datetime import datetime, UTC from dateutil import parser from data import ( ckan, @@ -121,7 +120,7 @@ def get_codelist_values(codelist_values_for_element): # Custom Jinja globals app.jinja_env.globals['dataset_to_publisher'] = dataset_to_publisher app.jinja_env.globals['url'] = lambda x: '/' if x == 'index.html' else x -app.jinja_env.globals['datetime_generated'] = lambda: datetime.utcnow().replace(tzinfo=pytz.utc).strftime('%-d %B %Y (at %H:%M %Z)') +app.jinja_env.globals['datetime_generated'] = lambda: datetime.now(UTC).strftime('%-d %B %Y (at %H:%M %Z)') app.jinja_env.globals['datetime_data'] = date_time_data_obj.strftime('%-d %B %Y (at %H:%M %Z)') app.jinja_env.globals['commit_hash'] = subprocess.run( 'git show --format=%H --no-patch'.split(), @@ -152,7 +151,7 @@ def get_codelist_values(codelist_values_for_element): app.jinja_env.globals['set'] = set app.jinja_env.globals['firstint'] = firstint app.jinja_env.globals['expected_versions'] = expected_versions -app.jinja_env.globals['current_year'] = datetime.utcnow().year +app.jinja_env.globals['current_year'] = datetime.now(UTC).year # Following variables set in coverage branch but not in master # app.jinja_env.globals['float'] = float # app.jinja_env.globals['dac2012'] = dac2012