fix time zone

This commit is contained in:
pstruebi
2022-09-04 19:27:54 +02:00
parent 9e0b0892e8
commit d1fc764255
3 changed files with 39 additions and 2 deletions

36
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,36 @@
{
"appService.zipIgnorePattern": [
"__pycache__{,/**}",
"*.py[cod]",
"*$py.class",
".Python{,/**}",
"build{,/**}",
"develop-eggs{,/**}",
"dist{,/**}",
"downloads{,/**}",
"eggs{,/**}",
".eggs{,/**}",
"lib{,/**}",
"lib64{,/**}",
"parts{,/**}",
"sdist{,/**}",
"var{,/**}",
"wheels{,/**}",
"share/python-wheels{,/**}",
"*.egg-info{,/**}",
".installed.cfg",
"*.egg",
"MANIFEST",
".env{,/**}",
".venv{,/**}",
"env{,/**}",
"venv{,/**}",
"ENV{,/**}",
"env.bak{,/**}",
"venv.bak{,/**}",
"venv_planner{,/**}",
".vscode{,/**}"
],
"appService.defaultWebAppToDeploy": "/subscriptions/988215e8-cbf3-4b36-8c6e-99d819f94fbf/microsoft.web/sites/subscriptions/988215e8-cbf3-4b36-8c6e-99d819f94fbf/resourceGroups/propedal-planner_group/providers/Microsoft.Web/sites/propedal-planner",
"appService.deploySubpath": "."
}

View File

@@ -129,10 +129,10 @@ def get_future_calendar_events():
def convert_datetime(event):
start_date_time = datetime.fromisoformat(event["start"]["dateTime"][:-1]) \
.replace(tzinfo=ZoneInfo('UTC')).astimezone(ZoneInfo('localtime'))
.replace(tzinfo=ZoneInfo('UTC')).astimezone(ZoneInfo(MsalConfig.TIME_ZONE))
stop_date_time = datetime.fromisoformat(event["end"]["dateTime"][:-1]) \
.replace(tzinfo=ZoneInfo('UTC')).astimezone(ZoneInfo('localtime'))
.replace(tzinfo=ZoneInfo('UTC')).astimezone(ZoneInfo(MsalConfig.TIME_ZONE))
event["start"]["date"] = start_date_time.strftime("%d.%m.%Y")
event["start"]["time"] = start_date_time.strftime("%H:%M:%S")

View File

@@ -26,6 +26,7 @@ class MsalDefaulConfig():
SECRET = "" # api secret key (from azure web interface)
USER_ID = "user@domain"
CALENDAR_ID = "" # calendar id - determined by /users/id/calendars
TIME_ZONE="Europe/Vienna"
class MsalConfig(MsalDefaulConfig):
AUTHORITY = "https://login.microsoftonline.com/propedal.at"