Skip to content

Commit

Permalink
bug fix in date_to_milliseconds, which getting wrong date(not UTC-0) …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
denis-sukhoverkhov committed Jun 4, 2018
1 parent 852b256 commit a5de83d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion binance/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a5de83d

Please sign in to comment.