1.1 --- a/imiptools/dates.py Sun Aug 02 19:29:16 2015 +0200
1.2 +++ b/imiptools/dates.py Sun Aug 02 19:36:33 2015 +0200
1.3 @@ -296,24 +296,25 @@
1.4 """
1.5
1.6 if isinstance(dt, datetime):
1.7 - return dt
1.8 + return to_timezone(dt, tzid)
1.9 else:
1.10 return get_start_of_day(dt, tzid)
1.11
1.12 -def to_utc_datetime(dt, date_tzid=None):
1.13 +def to_utc_datetime(dt, tzid=None):
1.14
1.15 """
1.16 - Return a datetime corresponding to 'dt' in the UTC time zone. If 'date_tzid'
1.17 - is specified, dates are converted to datetimes using the time zone
1.18 - information; otherwise, dates remain unconverted.
1.19 + Return a datetime corresponding to 'dt' in the UTC time zone. If 'tzid'
1.20 + is specified, dates and floating datetimes are converted to UTC datetimes
1.21 + using the time zone information; otherwise, such dates and datetimes remain
1.22 + unconverted.
1.23 """
1.24
1.25 if not dt:
1.26 return None
1.27 - elif isinstance(dt, datetime):
1.28 + elif get_datetime_tzid(dt):
1.29 return to_timezone(dt, "UTC")
1.30 - elif date_tzid:
1.31 - return to_timezone(to_datetime(dt, date_tzid), "UTC")
1.32 + elif tzid:
1.33 + return to_timezone(to_datetime(dt, tzid), "UTC")
1.34 else:
1.35 return dt
1.36