X-Git-Url: https://yuggoth.org/gitweb?a=blobdiff_plain;f=weather.py;h=322e83db9b52ada032ea55567c7679b89122163e;hb=29f424ec50d4b0d0d2885cd9f6c6b304245e067f;hp=cf9bc2368b927fb10abb933c8177c2eccd5bd40e;hpb=cc7cb0a6135462bdf8145bcd2df27743a906eb3b;p=weather.git diff --git a/weather.py b/weather.py index cf9bc23..322e83d 100644 --- a/weather.py +++ b/weather.py @@ -328,7 +328,13 @@ def get_alert( # hours ago import datetime, zoneinfo expiration = datetime.datetime.fromisoformat( - "%sT%sZ" % (expirycheck[1][:8], expirycheck[1][-4:])) + "%s-%s-%sT%s:%s" % ( + expirycheck[1][:4], + expirycheck[1][4:6], + expirycheck[1][6:8], + expirycheck[1][8:10], + expirycheck[1][-2:], + )).replace(tzinfo=zoneinfo.ZoneInfo("UTC")) now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC")) if now - expiration > datetime.timedelta(hours=delay): return ""