use replace.

This commit is contained in:
Jason Schwarzenberger 2020-11-05 16:57:08 +13:00
parent c21c71667e
commit 095f0d549a

View File

@ -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