From fedb16c242ad8f560cfbbcbec36e0004e9fdcf30 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sat, 5 Nov 2022 12:03:44 +0100 Subject: [PATCH] Little extra work on timezone config --- changedetectionio/__init__.py | 14 ++++++++++---- changedetectionio/model/App.py | 2 +- changedetectionio/templates/settings.html | 7 ++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 2af1a388..5aa860f0 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -721,13 +721,19 @@ def changedetection_app(config=None, datastore_o=None): else: flash("An error occurred, please see below.", "error") + import datetime + datetime = datetime.datetime.now(pytz.timezone(datastore.data['settings']['application'].get('timezone'))) + output = render_template("settings.html", - form=form, - current_base_url = datastore.data['settings']['application']['base_url'], - hide_remove_pass=os.getenv("SALTED_PASS", False), api_key=datastore.data['settings']['application'].get('api_access_token'), + current_base_url=datastore.data['settings']['application']['base_url'], + datetime=str(datetime), emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False), - settings_application=datastore.data['settings']['application']) + form=form, + hide_remove_pass=os.getenv("SALTED_PASS", False), + settings_application=datastore.data['settings']['application'], + timezone=datastore.data['settings']['application'].get('timezone') + ) return output diff --git a/changedetectionio/model/App.py b/changedetectionio/model/App.py index 60fe8534..26cc4865 100644 --- a/changedetectionio/model/App.py +++ b/changedetectionio/model/App.py @@ -40,7 +40,7 @@ class model(dict): 'password': False, 'render_anchor_tag_content': False, 'schema_version' : 0, - 'timezone': None, + 'timezone': 'UTC', 'webdriver_delay': None, # Extra delay in seconds before extracting text } } diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index f671c6ac..b6c1deda 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -175,7 +175,12 @@ nav
{{ render_field(form.application.form.timezone) }} - Current Date / Time and timezone is
+
+
+

+ {{ datetime }}
+ {{ timezone }}
+