Fix datetime parsing

This commit is contained in:
Mark Veidemanis 2022-04-19 21:03:23 +01:00
parent 36b9421846
commit dbf4a78651
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 2 additions and 1 deletions

View File

@ -123,10 +123,11 @@ def last_online_recent(date):
date[1].replace(":", "") date[1].replace(":", "")
date = "+".join(date_split) date = "+".join(date_split)
date_string = "%Y-%m-%dT%H:%M:%S%z" date_string = "%Y-%m-%dT%H:%M:%S%z"
now = datetime.now(timezone.utc)
else: else:
date_string = "%Y-%m-%dT%H:%M:%S.%fZ" date_string = "%Y-%m-%dT%H:%M:%S.%fZ"
now = datetime.now()
date_parsed = datetime.strptime(date, date_string) date_parsed = datetime.strptime(date, date_string)
now = datetime.now(timezone.utc)
sec_ago_date = (now - date_parsed).total_seconds() sec_ago_date = (now - date_parsed).total_seconds()
return sec_ago_date < 172800 return sec_ago_date < 172800