Skip to content

Commit a5de83d

Browse files
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.
1 parent 852b256 commit a5de83d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

binance/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def date_to_milliseconds(date_str):
1919
# get epoch value in UTC
2020
epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
2121
# parse our date string
22-
d = dateparser.parse(date_str)
22+
d = dateparser.parse(date_str, settings={'TO_TIMEZONE': 'UTC'})
2323
# if the date is not timezone aware apply UTC timezone
2424
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
2525
d = d.replace(tzinfo=pytz.utc)

0 commit comments

Comments
 (0)