From b1cf4600ca7755fed5fbae513574c91c7c8f55a5 Mon Sep 17 00:00:00 2001 From: Carina Antunes <carina.oliveira.antunes@cern.ch> Date: Mon, 14 Jun 2021 07:38:45 +0000 Subject: [PATCH] [#51] Fix date coming from backend timezone --- .isort.cfg | 2 +- notifications_consumer/processors/email/processor.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index 0ba4220..f399f14 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -4,4 +4,4 @@ multi_line_output=3 include_trailing_comma=True lines_after_imports=2 not_skip=__init__.py -known_third_party = Crypto,apns2,jinja2,megabus,pytest,pywebpush,requests,sqlalchemy,stomp,yaml +known_third_party = Crypto,apns2,dateutil,jinja2,megabus,pytest,pywebpush,requests,sqlalchemy,stomp,yaml diff --git a/notifications_consumer/processors/email/processor.py b/notifications_consumer/processors/email/processor.py index d187748..1616e45 100644 --- a/notifications_consumer/processors/email/processor.py +++ b/notifications_consumer/processors/email/processor.py @@ -36,7 +36,8 @@ class EmailProcessor(Processor): created_at = kwargs.get("created_at", "") try: - created_at = datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%S.%fZ").strftime("%m/%d/%Y, %H:%M:%S") + created_at = datetime.strptime(created_at, "%m/%d/%Y, %H:%M:%S").strftime("%m/%d/%Y, %H:%M:%S") + except Exception: logging.exception("Failed to process created at date") -- GitLab