gcal-bot: Handle all-day events

(imported from commit 7395f2cdd2003b24ce59a1dbdf6f6ae24b6eae6c)
This commit is contained in:
Keegan McAllister 2013-01-16 13:51:32 -05:00
parent 96cd0fc325
commit 9045ecae65

View file

@ -93,7 +93,9 @@ def get_events():
for event in feed.entry: for event in feed.entry:
start = event.when[0].start.split('.')[0] start = event.when[0].start.split('.')[0]
start = datetime.datetime.strptime(start, '%Y-%m-%dT%H:%M:%S') # All-day events can have only a date
fmt = '%Y-%m-%dT%H:%M:%S' if 'T' in start else '%Y-%m-%d'
start = datetime.datetime.strptime(start, fmt)
yield (event.uid.value, start, event.title.text) yield (event.uid.value, start, event.title.text)
# Our cached view of the calendar, updated periodically. # Our cached view of the calendar, updated periodically.