From c89e7259f694c72a927cf8a9edff2f2bfcab3628 Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Feb 2026 00:41:09 +0300 Subject: [PATCH] Fix NPMplus expiry timezone handling --- services/npmplus.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/npmplus.py b/services/npmplus.py index 828ae0b..6418ed9 100644 --- a/services/npmplus.py +++ b/services/npmplus.py @@ -14,8 +14,12 @@ def _parse_expiry(value: str | None) -> datetime | None: cleaned = value.strip() try: if cleaned.endswith("Z"): - return datetime.fromisoformat(cleaned.replace("Z", "+00:00")) - return datetime.fromisoformat(cleaned) + dt = datetime.fromisoformat(cleaned.replace("Z", "+00:00")) + else: + dt = datetime.fromisoformat(cleaned) + if dt.tzinfo is None: + dt = dt.replace(tzinfo=timezone.utc) + return dt except ValueError: for fmt in ("%Y-%m-%d %H:%M:%S", "%Y-%m-%d"): try: