mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-01-20 23:18:23 +00:00
convert start_date in prepare_sync
This commit is contained in:
parent
3ef89e6d32
commit
4f16b8f66b
@ -1,7 +1,7 @@
|
||||
import dateutil.parser
|
||||
import logging
|
||||
import operator
|
||||
|
||||
from pytz import utc
|
||||
|
||||
class CalendarSync():
|
||||
logger = logging.getLogger('CalendarSync')
|
||||
@ -75,8 +75,18 @@ class CalendarSync():
|
||||
return op(dateutil.parser.parse(event['updated']), date)
|
||||
|
||||
return list(filter(filter_by_date, events))
|
||||
|
||||
|
||||
@staticmethod
|
||||
def _tz_aware_datetime(date):
|
||||
if not isinstance(date, datetime.datetime):
|
||||
date = datetime.datetime(date.year, date.month, date.day)
|
||||
if date.tzinfo is None:
|
||||
date = date.replace(tzinfo=utc)
|
||||
return date
|
||||
|
||||
def prepare_sync(self, start_date):
|
||||
start_date = _tz_aware_datetime(start_date)
|
||||
|
||||
events_src = self.converter.events_to_gcal()
|
||||
events_dst = self.gcalendar.list_events_from(start_date)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user