Remove tz_aware date code

This commit is contained in:
Elyse 2023-03-11 18:20:32 -06:00
parent a43ba2eff6
commit cdac7641d6

View file

@ -1868,9 +1868,8 @@ def unified_timestamp(date_str, day_first=True, with_milliseconds=False):
for expression in date_formats(day_first):
with contextlib.suppress(ValueError):
dt = datetime.datetime.strptime(date_str, expression) + datetime.timedelta(hours=pm_delta)
dt_tz_aware = dt.replace(tzinfo=datetime.timezone(timezone))
return dt_tz_aware.timestamp() if with_milliseconds else int(dt_tz_aware.timestamp())
dt = datetime.datetime.strptime(date_str, expression) - timezone + datetime.timedelta(hours=pm_delta)
return calendar.timegm(dt.timetuple()) + (dt.microsecond / 1e6 if with_milliseconds else 0)
timetuple = email.utils.parsedate_tz(date_str)
if timetuple: