From 4e95f8494853e803ab8225555a4783d3a6fc6613 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 30 Dec 2013 14:44:47 +1100 Subject: [PATCH] ical: avoid returning invalid dates for MONTHLY lists. If a MONTHLY list starts on the 31st of the month, we mustn't return e.g. 31st June. --- lib/ical.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ical.py b/lib/ical.py index c4afe36..5081d1b 100644 --- a/lib/ical.py +++ b/lib/ical.py @@ -216,7 +216,7 @@ class date_seq: else: return None self.now.set_wday() - return self.now + return self.now, self.now.day <= daysin(self.now.mon, self.now.yr) # Each BY* is filter which will discards moments, or generates sub-moments. # e.g. BYMONTH will discard non-matching MONTHLY, WEEKLY etc moments, and @@ -652,7 +652,9 @@ def make_dates(start, rr): if n1: last = n1[-1] ret.extend(n1) - last = s.next() + last, valid = s.next() + while not valid and 'BYDAY' not in rr.bylist and 'BYMONTHDAY' not in rr.bylist: + last, valid = s.next() if rr.count: ret = ret[:rr.count] if rr.end: -- 2.43.0