From c50005e7c78634e08d94ea1818953e2902ff6897 Mon Sep 17 00:00:00 2001 From: MMXX Date: Sun, 19 Dec 2021 09:06:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BF=80=E6=B4=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/baseutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fir_ser/api/utils/baseutils.py b/fir_ser/api/utils/baseutils.py index f606a71..ac6a49c 100644 --- a/fir_ser/api/utils/baseutils.py +++ b/fir_ser/api/utils/baseutils.py @@ -249,7 +249,11 @@ def get_post_udid_url(request, short): def format_apple_date(s_date): - f_date = datetime.datetime.strptime(s_date, '%Y-%m-%dT%H:%M:%S.000+0000') + try: + f_date = datetime.datetime.strptime(s_date, '%Y-%m-%dT%H:%M:%S.000+0000') + except Exception as e: + f_date = datetime.datetime.strptime(s_date, '%Y-%m-%dT%H:%M:%S.000+00:00') + if not timezone.is_naive(f_date): f_date = timezone.make_naive(f_date, timezone.utc) return f_date