if a timezone isn't found, prepend it with "Etc/" (for e.g. "Etc/GMT+1")

This commit is contained in:
jesopo 2020-01-01 11:27:24 +00:00
parent 9efb0b05fc
commit fc0e6bdce0

View file

@ -45,6 +45,8 @@ 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):
if not timezone in pytz.all_timezones:
timezone = "Etc/%s" % timezone
dt = dt.astimezone(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"