From 9045ecae656d3541b0bdf6537fdeb0af15ab7096 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 16 Jan 2013 13:51:32 -0500 Subject: [PATCH] gcal-bot: Handle all-day events (imported from commit 7395f2cdd2003b24ce59a1dbdf6f6ae24b6eae6c) --- bots/gcal-bot | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bots/gcal-bot b/bots/gcal-bot index 14e1412..f51d5f9 100755 --- a/bots/gcal-bot +++ b/bots/gcal-bot @@ -93,7 +93,9 @@ def get_events(): for event in feed.entry: 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) # Our cached view of the calendar, updated periodically.