From: Morgen Sagen <sagen@apple.com>
Date: Mon, 4 Jan 2010 20:27:01 +0100
Subject: Treat untils as floating

---
 vobject/icalendar.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/vobject/icalendar.py b/vobject/icalendar.py
index bfb00df..add91f7 100644
--- a/vobject/icalendar.py
+++ b/vobject/icalendar.py
@@ -478,6 +478,18 @@ class RecurringComponent(Component):
                         if dtstart.tzinfo is None:
                             until = until.replace(tzinfo=None)
 
+                        # RFC2445 actually states that UNTIL must be a UTC value. Whilst the
+                        # changes above work OK, one problem case is if DTSTART is floating but
+                        # UNTIL is properly specified as UTC (or with a TZID). In that case dateutil
+                        # will fail datetime comparisons. There is no easy solution to this as
+                        # there is no obvious timezone (at this point) to do proper floating time
+                        # offset compisons. The best we can do is treat the UNTIL value as floating.
+                        # This could mean incorrect determination of the last instance. The better
+                        # solution here is to encourage clients to use COUNT rather than UNTIL
+                        # when DTSTART is floating.
+                        if dtstart.tzinfo is None:
+                            until = until.replace(tzinfo=None)
+
                         rule._until = until
 
                     # add the rrule or exrule to the rruleset
