From a5de83db532a10e3972a175ed54a455571a9420c Mon Sep 17 00:00:00 2001 From: Denis Sukhoverkhov Date: Mon, 4 Jun 2018 08:27:07 +0300 Subject: [PATCH] bug fix in date_to_milliseconds, which getting wrong date(not UTC-0) when i passed date in timestamp. I getting date with my timezone - it is wrong, because date_to_milliseconds works only with utc-0 datetime-objects. --- binance/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binance/helpers.py b/binance/helpers.py index fe91df3f4..35fe90c2c 100644 --- a/binance/helpers.py +++ b/binance/helpers.py @@ -19,7 +19,7 @@ def date_to_milliseconds(date_str): # get epoch value in UTC epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc) # parse our date string - d = dateparser.parse(date_str) + d = dateparser.parse(date_str, settings={'TO_TIMEZONE': 'UTC'}) # if the date is not timezone aware apply UTC timezone if d.tzinfo is None or d.tzinfo.utcoffset(d) is None: d = d.replace(tzinfo=pytz.utc)