diff --git a/charts/ohayodash/values.yaml b/charts/ohayodash/values.yaml index 303818f..aa84fee 100644 --- a/charts/ohayodash/values.yaml +++ b/charts/ohayodash/values.yaml @@ -18,6 +18,8 @@ image: env: # -- Set the container timezone TZ: UTC + # -- Python date format string to use for rendering the date/time + DATE_FORMAT: "%Y-%m-%d %H:%M" # -- Configures service settings for the chart. # @default -- See values.yaml diff --git a/ohayodash/base.py b/ohayodash/base.py index 97bfb5c..1a8448b 100644 --- a/ohayodash/base.py +++ b/ohayodash/base.py @@ -94,6 +94,11 @@ def get_greeting(): return 'こんにちは' +@base.app_template_filter() +def format_datetime(value, format='medium'): + return value.strftime(os.environ.get('DATE_FORMAT', '%Y-%m-%d %H:%M')) # noqa: WPS323 + + @base.route('/') def index(): return render_template('index.j2', diff --git a/ohayodash/templates/index.j2 b/ohayodash/templates/index.j2 index 54a9d3c..b263889 100644 --- a/ohayodash/templates/index.j2 +++ b/ohayodash/templates/index.j2 @@ -53,7 +53,7 @@ {% if applications %}