Skip to content

Commit

Permalink
Updates for proper timezone support in cal feed. Issue #39
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Tucker committed Oct 29, 2013
1 parent 42753b3 commit 3275026
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions whistlepig/ical/ical_entries_feed.py
Expand Up @@ -22,25 +22,30 @@ def item_summary(self, item):

def get_time_as_utc(self, input_time, item):
utc_tz = pytz.timezone('UTC')
pacific_tz = pytz.timezone('America/Los_Angeles')
tmp = datetime.datetime(
input_time.year,
input_time.month,
input_time.day,
input_time.hour,
input_time.minute,
input_time.second)
if item.timezone.name != u'UTC':
tz = pytz.timezone('US/Pacific')
tmp = datetime.datetime(
tmp = pacific_tz.localize(datetime.datetime(
input_time.year,
input_time.month,
input_time.day,
input_time.hour,
input_time.minute,
input_time.second,
tzinfo = tz)
input_time.second))
else:
tmp = datetime.datetime(
input_time.year,
input_time.month,
input_time.day,
input_time.hour,
input_time.minute,
input_time.second,
tzinfo = utc_tz)
input_time.second)
return tmp.astimezone(utc_tz)

def item_start(self, item):
Expand Down

0 comments on commit 3275026

Please sign in to comment.