From 095f0d549a5a76db6025d0e5be39db87694033f6 Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Thu, 5 Nov 2020 16:57:08 +1300 Subject: [PATCH] use replace. --- apiserver/feeds/news.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apiserver/feeds/news.py b/apiserver/feeds/news.py index 7b2bb91..52f5d54 100644 --- a/apiserver/feeds/news.py +++ b/apiserver/feeds/news.py @@ -29,14 +29,14 @@ def unix(date_str, tz=None): try: dt = datetime.strptime(date_str, f) if tz: - dt = dt.astimezone(pytz.timezone(tz)) + dt = dt.replace(tzinfo=pytz.timezone(tz)) return int(dt.timestamp()) except: pass try: dt = datetime.strptime(date_tzfix, f) if tz: - dt = dt.astimezone(pytz.timezone(tz)) + dt = dt.replace(tzinfo=pytz.timezone(tz)) return int(dt.timestamp()) except: pass