1.1 --- a/imiptools/dates.py Wed Jan 21 19:04:10 2015 +0100
1.2 +++ b/imiptools/dates.py Thu Jan 22 17:50:22 2015 +0100
1.3 @@ -39,7 +39,7 @@
1.4 if not dt:
1.5 return None
1.6 elif isinstance(dt, datetime):
1.7 - return dt.astimezone(timezone("UTC"))
1.8 + return to_timezone(dt, "UTC")
1.9 else:
1.10 return dt
1.11
1.12 @@ -48,6 +48,9 @@
1.13 tz = name and timezone(name) or None
1.14 except UnknownTimeZoneError:
1.15 tz = None
1.16 + return to_tz(dt, tz)
1.17 +
1.18 +def to_tz(dt, tz):
1.19 if tz is not None:
1.20 if not dt.tzinfo:
1.21 return tz.localize(dt)