[FIX] resource: Fix annoying bug with timezones
When encoding global leaves, we put the timezone of this particular leave to False, which raises an exception when given directly to pytz. Simple solution is to pass 'UTC' in case we receive False. This behaviour might be improved in master later.
This commit is contained in:
@@ -34,7 +34,7 @@ def to_naive_utc(datetime, record):
|
||||
|
||||
|
||||
def to_tz(datetime, tz_name):
|
||||
tz = pytz.timezone(tz_name)
|
||||
tz = pytz.timezone(tz_name) if tz_name else pytz.UTC
|
||||
return pytz.UTC.localize(datetime.replace(tzinfo=None), is_dst=False).astimezone(tz).replace(tzinfo=None)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user