Fix NPMplus expiry timezone handling
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user