mirror of
https://github.com/nikdoof/ohayodash.git
synced 2025-12-13 18:12:17 +00:00
Make the date format user configurable
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<section id="header">
|
||||
<h1>{{ greeting | default("Welcome")}}</h1>
|
||||
<h2>{{ now }}</h2>
|
||||
<h2>{{ now | format_datetime }}</h2>
|
||||
</section>
|
||||
|
||||
{% if applications %}
|
||||
|
||||
Reference in New Issue
Block a user