Use datetime.fromisoformat() to parse dates in tracker import

This would allow preserving original time zone information and also
handles negative UTC offset values.
This commit is contained in:
Denis Laxalde 2021-01-18 16:01:12 +01:00 committed by Drew DeVault
parent 04135b65ca
commit 6b683af18e
1 changed files with 1 additions and 3 deletions

View File

@ -18,9 +18,7 @@ from todosrht.webhooks import worker
our_upstream = get_origin("todo.sr.ht", external=True)
def _parse_date(date):
if "+" in date:
date = date[:date.index("+")]
date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S")
date = datetime.fromisoformat(date)
date = date.astimezone(timezone.utc).replace(tzinfo=None)
return date