don't use .replace for timezone, use .astimezone

This commit is contained in:
jesopo 2019-12-30 17:18:54 +00:00
parent e1f8e8a524
commit 6380e80282

View file

@ -45,7 +45,7 @@ class Module(ModuleManager.BaseModule):
return LocationType.NAME, event["args"], None return LocationType.NAME, event["args"], None
def _timezoned(self, dt, timezone): def _timezoned(self, dt, timezone):
dt = dt.replace(tzinfo=pytz.timezone(timezone)) dt = dt.astimezone(pytz.timezone(timezone))
utc_offset = (dt.utcoffset().total_seconds()/60)/60 utc_offset = (dt.utcoffset().total_seconds()/60)/60
tz = "UTC" tz = "UTC"
if not utc_offset == 0.0: if not utc_offset == 0.0: