diff --git a/apprise/plugins/base.py b/apprise/plugins/base.py index 0738a326..2f3065e8 100644 --- a/apprise/plugins/base.py +++ b/apprise/plugins/base.py @@ -31,6 +31,7 @@ from datetime import tzinfo from functools import partial import re from typing import Any, ClassVar, Optional, TypedDict, Union +from zoneinfo import ZoneInfo from ..apprise_attachment import AppriseAttachment from ..common import ( @@ -875,8 +876,8 @@ class NotifyBase(URLBase): "overflow": self.overflow_mode.value, } - # Timezone Information - if self.__tzinfo: + # Timezone Information (if ZoneInfo) + if self.__tzinfo and isinstance(self.__tzinfo, ZoneInfo): params["tz"] = self.__tzinfo.key # Persistent Storage Setting diff --git a/apprise/utils/time.py b/apprise/utils/time.py index 5d150c73..893d55b9 100644 --- a/apprise/utils/time.py +++ b/apprise/utils/time.py @@ -25,6 +25,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. import contextlib +from datetime import timezone as _tz from typing import Optional from zoneinfo import ZoneInfo, ZoneInfoNotFoundError @@ -40,9 +41,14 @@ def zoneinfo(name: str) -> Optional[ZoneInfo]: if not isinstance(name, str): return None - # Normalise common UTC spellings - if name.lower() in {"utc", "z", "gmt"}: - name = "UTC" + raw = name.strip() + if not raw: + return None + + # Windows-safe: accept UTC family even without tzdata + if raw.lower() in { + "utc", "z", "gmt", "etc/utc", "etc/gmt", "gmt0", "utc0"}: + return _tz.utc # Try exact match first try: diff --git a/pyproject.toml b/pyproject.toml index 975c60ca..78be0783 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,8 @@ dependencies = [ "PyYAML", # Root certificate authority bundle "certifi", + # Always ship IANA tzdb on Windows so ZoneInfo works + "tzdata; platform_system == 'Windows'", ] # Identifies all of the supported plugins @@ -220,6 +222,7 @@ all-plugins = [ ] windows = [ "pywin32", + "tzdata", ] [project.urls] diff --git a/win-requirements.txt b/win-requirements.txt index 3cd15009..7dc71239 100644 --- a/win-requirements.txt +++ b/win-requirements.txt @@ -4,3 +4,4 @@ # occur in pyproject.toml. Contents of this file can be found # in [project.optional-dependencies].windows pywin32 +tzdata