1
0
mirror of https://github.com/polakowo/vectorbt.git synced 2022-03-22 01:31:39 +03:00

Merge pull request #417 from forLinDre/forLinDre-dev

utils 'datetime_.py' 'to_timezone' function change
This commit is contained in:
Oleg Polakow
2022-03-17 18:49:16 +01:00
committed by GitHub

View File

@@ -100,7 +100,7 @@ def to_timezone(tz: tp.TimezoneLike, to_py_timezone: tp.Optional[bool] = None, *
if isinstance(tz, timedelta):
tz = timezone(tz)
if isinstance(tz, tzinfo):
if to_py_timezone or tz != copy.copy(tz):
if to_py_timezone:
return timezone(tz.utcoffset(datetime.now()))
return tz
raise TypeError("Couldn't parse the timezone")