summaryrefslogtreecommitdiff
path: root/debian/patches/0003-Treat-untils-as-floating.patch
blob: e788401ad19928a0d7b61d5586ff0823dcff3633 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From: Morgen Sagen <sagen@apple.com>
Date: Mon, 4 Jan 2010 20:27:01 +0100
Subject: Treat untils as floating

---
 vobject/icalendar.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

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