kopia lustrzana https://github.com/jazzband/icalevents
Fix: Recurring All Day Events
rodzic
583ae2c881
commit
650ed91915
|
@ -112,7 +112,7 @@ class Event:
|
||||||
duration = self.end - self.start
|
duration = self.end - self.start
|
||||||
ne.end = (new_start + duration)
|
ne.end = (new_start + duration)
|
||||||
|
|
||||||
ne.all_day = (self.all_day and (new_start - self.start).seconds == 0)
|
ne.all_day = self.all_day
|
||||||
ne.uid = uid
|
ne.uid = uid
|
||||||
|
|
||||||
return ne
|
return ne
|
||||||
|
|
|
@ -6,7 +6,7 @@ BEGIN:VEVENT
|
||||||
DTSTART;TZID=Europe/Berlin:20181003T100000
|
DTSTART;TZID=Europe/Berlin:20181003T100000
|
||||||
DTEND;TZID=Europe/Berlin:20181003T120000
|
DTEND;TZID=Europe/Berlin:20181003T120000
|
||||||
DESCRIPTION:Event recurring on wednesday each week, except on 2018-10-29
|
DESCRIPTION:Event recurring on wednesday each week, except on 2018-10-29
|
||||||
SUMARRY:Recurring Event
|
SUMMARY:Recurring Event
|
||||||
RRULE:FREQ=WEEKLY;BYDAY=MO
|
RRULE:FREQ=WEEKLY;BYDAY=MO
|
||||||
EXDATE;TZID=Europe/Berlin:20181029T100000
|
EXDATE;TZID=Europe/Berlin:20181029T100000
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
|
@ -14,9 +14,16 @@ BEGIN:VEVENT
|
||||||
DTSTART;TZID=Europe/Berlin:20180601T100000
|
DTSTART;TZID=Europe/Berlin:20180601T100000
|
||||||
DTEND;TZID=Europe/Berlin:20180601T120000
|
DTEND;TZID=Europe/Berlin:20180601T120000
|
||||||
DESCRIPTION:Event recurring on friday each week, except on 2018-06-08/22
|
DESCRIPTION:Event recurring on friday each week, except on 2018-06-08/22
|
||||||
SUMARRY:Recurring Event
|
SUMMARY:Recurring Event
|
||||||
RRULE:FREQ=WEEKLY;BYDAY=FR
|
RRULE:FREQ=WEEKLY;BYDAY=FR
|
||||||
EXDATE;TZID=Europe/Berlin:20180608T100000
|
EXDATE;TZID=Europe/Berlin:20180608T100000
|
||||||
EXDATE;TZID=Europe/Berlin:20180622T100000
|
EXDATE;TZID=Europe/Berlin:20180622T100000
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
|
BEGIN:VEVENT
|
||||||
|
DTSTART;VALUE=DATE:20181030
|
||||||
|
DTEND;VALUE=DATE:20181031
|
||||||
|
DESCRIPTION:All-day event recurring on tuesday each week
|
||||||
|
SUMMARY:Recurring All-day Event
|
||||||
|
RRULE:FREQ=WEEKLY;BYDAY=TU
|
||||||
|
END:VEVENT
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
|
|
@ -81,6 +81,33 @@ class ICalEventsTests(unittest.TestCase):
|
||||||
self.assertEqual(evs[1].start.day, 15, "check first exdate.")
|
self.assertEqual(evs[1].start.day, 15, "check first exdate.")
|
||||||
self.assertEqual(evs[2].start.day, 29, "check second exdate.")
|
self.assertEqual(evs[2].start.day, 29, "check second exdate.")
|
||||||
|
|
||||||
|
def test_events_all_day_recurring(self):
|
||||||
|
ical = "test/test_data/recurring.ics"
|
||||||
|
start = date(2018, 10, 30)
|
||||||
|
end = date(2018, 10, 31)
|
||||||
|
|
||||||
|
evs = icalevents.events(file=ical, start=start, end=end)
|
||||||
|
|
||||||
|
event_set = icalevents.events(url=None, file=ical, start=start, end=end)
|
||||||
|
ev = event_set[0]
|
||||||
|
|
||||||
|
self.assertEqual(len(event_set), 1)
|
||||||
|
self.assertEqual(ev.summary, "Recurring All-day Event")
|
||||||
|
self.assertEqual(ev.description, "All-day event recurring on tuesday each week")
|
||||||
|
self.assertTrue(ev.all_day, "Recurring All-day Event's first instance is an all-day event")
|
||||||
|
|
||||||
|
start_2nd_instance = date(2018, 11, 6)
|
||||||
|
end_2nd_instance = date(2018, 11, 7)
|
||||||
|
|
||||||
|
event_set2 = icalevents.events(url=None, file=ical, start=start_2nd_instance, end=end_2nd_instance)
|
||||||
|
ev_2 = event_set2[0]
|
||||||
|
|
||||||
|
self.assertEqual(len(event_set2), 1)
|
||||||
|
self.assertEqual(ev_2.summary, "Recurring All-day Event")
|
||||||
|
self.assertEqual(ev_2.description, "All-day event recurring on tuesday each week")
|
||||||
|
self.assertTrue(ev_2.all_day, "Recurring All-day Event's second instance is an all-day event")
|
||||||
|
|
||||||
|
|
||||||
def test_event_attributes(self):
|
def test_event_attributes(self):
|
||||||
ical = "test/test_data/basic.ics"
|
ical = "test/test_data/basic.ics"
|
||||||
start = date(2017, 7, 12)
|
start = date(2017, 7, 12)
|
||||||
|
|
Ładowanie…
Reference in New Issue