From a2a4f2e4b47ed8ec3ddf13f95541198f0a820303 Mon Sep 17 00:00:00 2001 From: Xavier Bouthillier Date: Mon, 13 Mar 2023 09:31:00 -0400 Subject: [PATCH] Fix tzlocal Now that we are in daylight saving time instead of eastern standard time, the code to determine local time zone is failing because `zoneinfo` does not know what EDT is. Using `tzlocal.get_localzone_name()` works well enough because `datetime` seems to know we are in daylight saving time. --- sarc/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sarc/config.py b/sarc/config.py index e26cc5f0..59a90729 100644 --- a/sarc/config.py +++ b/sarc/config.py @@ -8,6 +8,7 @@ from pathlib import Path from typing import Any, Union +import tzlocal from bson import ObjectId from pydantic import BaseModel as _BaseModel from pydantic import Extra, validator @@ -15,7 +16,7 @@ MTL = zoneinfo.ZoneInfo("America/Montreal") PST = zoneinfo.ZoneInfo("America/Vancouver") UTC = zoneinfo.ZoneInfo("UTC") -TZLOCAL = zoneinfo.ZoneInfo(str(datetime.now().astimezone().tzinfo)) +TZLOCAL = zoneinfo.ZoneInfo(tzlocal.get_localzone_name()) class ConfigurationError(Exception):