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): def _get_date(date):
"""Get the dateTime from date or dateTime as a local.""" """Get the dateTime from date or dateTime as a local."""
if 'date' in date: if 'date' in date:
return dt.as_utc(dt.dt.datetime.combine( return dt.start_of_local_day(dt.dt.datetime.combine(
dt.parse_date(date['date']), dt.dt.time())) dt.parse_date(date['date']), dt.dt.time.min))
else: else:
return dt.parse_datetime(date['dateTime']) return dt.as_local(dt.parse_datetime(date['dateTime']))
start = _get_date(self.data.event['start']) start = _get_date(self.data.event['start'])
end = _get_date(self.data.event['end']) end = _get_date(self.data.event['end'])

View File

@ -66,7 +66,7 @@ class GoogleCalendarData(object):
"""Get the latest data.""" """Get the latest data."""
service = self.calendar_service.get() service = self.calendar_service.get()
params = dict(DEFAULT_GOOGLE_SEARCH_PARAMS) 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 params['calendarId'] = self.calendar_id
if self.search: if self.search:
params['q'] = self.search params['q'] = self.search

View File

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