This commit is contained in:
happyleavesaoc 2017-01-08 17:50:42 -05:00 committed by Paulus Schoutsen
parent f643149d24
commit 81f988cf9e
3 changed files with 8 additions and 8 deletions

View file

@ -147,10 +147,10 @@ class CalendarEventDevice(Entity):
def _get_date(date):
"""Get the dateTime from date or dateTime as a local."""
if 'date' in date:
return dt.as_utc(dt.dt.datetime.combine(
dt.parse_date(date['date']), dt.dt.time()))
return dt.start_of_local_day(dt.dt.datetime.combine(
dt.parse_date(date['date']), dt.dt.time.min))
else:
return dt.parse_datetime(date['dateTime'])
return dt.as_local(dt.parse_datetime(date['dateTime']))
start = _get_date(self.data.event['start'])
end = _get_date(self.data.event['end'])

View file

@ -66,7 +66,7 @@ class GoogleCalendarData(object):
"""Get the latest data."""
service = self.calendar_service.get()
params = dict(DEFAULT_GOOGLE_SEARCH_PARAMS)
params['timeMin'] = dt.utcnow().isoformat('T')
params['timeMin'] = dt.start_of_local_day().isoformat('T')
params['calendarId'] = self.calendar_id
if self.search:
params['q'] = self.search

View file

@ -96,8 +96,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
'message': event['summary'],
'all_day': True,
'offset_reached': False,
'start_time': '{} 06:00:00'.format(event['start']['date']),
'end_time': '{} 06:00:00'.format(event['end']['date']),
'start_time': '{} 00:00:00'.format(event['start']['date']),
'end_time': '{} 00:00:00'.format(event['end']['date']),
'location': event['location'],
'description': event['description']
})
@ -416,8 +416,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
'message': event_summary,
'all_day': True,
'offset_reached': False,
'start_time': '{} 06:00:00'.format(event['start']['date']),
'end_time': '{} 06:00:00'.format(event['end']['date']),
'start_time': '{} 00:00:00'.format(event['start']['date']),
'end_time': '{} 00:00:00'.format(event['end']['date']),
'location': event['location'],
'description': event['description']
})