Skip to content

Commit

Permalink
Merge pull request #23 from dlichtistw/Fix-all_day
Browse files Browse the repository at this point in the history
Fix all_day recognition
  • Loading branch information
irgangla authored Sep 13, 2018
2 parents 652f522 + c635996 commit a7b9b58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ calendars.txt
.coverage
dist/*
MANIFEST
icalevents.egg-info/*
4 changes: 3 additions & 1 deletion icalevents/icalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self):
"""
self.uid = -1
self.summary = None
self.description = None
self.start = None
self.end = None
self.all_day = True
Expand Down Expand Up @@ -103,6 +104,7 @@ def copy_to(self, new_start=None, uid=None):

ne = Event()
ne.summary = self.summary
ne.description = self.description
ne.start = new_start
ne.end = (new_start + duration)
ne.all_day = (self.all_day and (new_start - self.start).seconds == 0)
Expand Down Expand Up @@ -158,7 +160,7 @@ def create_event(component):
event.end = event_end
event.summary = str(component.get('summary'))
event.description = str(component.get('description'))
event.all_day = type(component.get('dtstart').dt) is datetime.date
event.all_day = type(component.get('dtstart').dt) is date

return event

Expand Down
2 changes: 1 addition & 1 deletion test/test_icalevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_event_attributes(self):

self.assertEqual(ev.summary, "graue Restmülltonne")
self.assertEqual(ev.description, "graue Restmülltonne nicht vergessen!")
self.assertFalse(ev.all_day)
self.assertTrue(ev.all_day)

def test_events_async_url(self):
url = "https://raw.githubusercontent.com/irgangla/icalevents/master/test/test_data/basic.ics"
Expand Down

0 comments on commit a7b9b58

Please sign in to comment.