Ensure that dttm is of same timezone as epoch_with_tz (#6453)

This commit is contained in:
Ville Brofeldt 2018-11-28 07:59:23 +02:00 committed by Maxime Beauchemin
parent 71a713dcec
commit 4579b12732
1 changed files with 1 additions and 0 deletions

View File

@ -358,6 +358,7 @@ def pessimistic_json_iso_dttm_ser(obj):
def datetime_to_epoch(dttm):
if dttm.tzinfo:
dttm = dttm.replace(tzinfo=pytz.utc)
epoch_with_tz = pytz.utc.localize(EPOCH)
return (dttm - epoch_with_tz).total_seconds() * 1000
return (dttm - EPOCH).total_seconds() * 1000