@@ -191,11 +191,18 @@ def _ical_parser(self, calendar, from_date, to_date):
191191 event ["DTSTART" ].dt , dt .DEFAULT_TIME_ZONE
192192 )
193193
194- # If we don't have a DTEND, just use DTSTART
195194 if "DTEND" not in event :
196- dtend = dtstart
195+ _LOGGER .debug ("Event found without end datetime" )
196+ if self .all_day :
197+ # if it's an all day event with no endtime listed, we'll assume it ends at 23:59:59
198+ _LOGGER .debug (f"Event { event ['SUMMARY' ]} is flagged as all day, with a start time of { start } ." )
199+ dtend = dtstart + timedelta (days = 1 , seconds = - 1 )
200+ _LOGGER .debug (f"Setting the end time to { dtend } " )
201+ else :
202+ _LOGGER .debug (f"Event { event ['SUMMARY' ]} doesn't have an end but isn't flagged as all day." )
203+ dtend = dtstart
197204 else :
198- _LOGGER .debug ("DTEND in rrule: %s" , str ( event [ "DTEND" ]. dt ) )
205+ _LOGGER .debug ("DTEND in event" )
199206 dtend = self ._ical_date_fixer (
200207 event ["DTEND" ].dt , dt .DEFAULT_TIME_ZONE
201208 )
@@ -329,7 +336,15 @@ def _ical_parser(self, calendar, from_date, to_date):
329336 start = dtstart
330337
331338 if "DTEND" not in event :
332- dtend = dtstart
339+ _LOGGER .debug ("Event found without end datetime" )
340+ if self .all_day :
341+ # if it's an all day event with no endtime listed, we'll assume it ends at 23:59:59
342+ _LOGGER .debug (f"Event { event ['SUMMARY' ]} is flagged as all day, with a start time of { start } ." )
343+ dtend = dtstart + timedelta (days = 1 , seconds = - 1 )
344+ _LOGGER .debug (f"Setting the end time to { dtend } " )
345+ else :
346+ _LOGGER .debug (f"Event { event ['SUMMARY' ]} doesn't have an end but isn't flagged as all day." )
347+ dtend = dtstart
333348 else :
334349 _LOGGER .debug ("DTEND in event" )
335350 dtend = self ._ical_date_fixer (
0 commit comments