summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/icalendar/files/2.1_p20100409/02_all_vDatetime-tzinfo-fix.patch')
-rw-r--r--dev-python/icalendar/files/2.1_p20100409/02_all_vDatetime-tzinfo-fix.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/dev-python/icalendar/files/2.1_p20100409/02_all_vDatetime-tzinfo-fix.patch b/dev-python/icalendar/files/2.1_p20100409/02_all_vDatetime-tzinfo-fix.patch
new file mode 100644
index 000000000000..7f06b4f68c9e
--- /dev/null
+++ b/dev-python/icalendar/files/2.1_p20100409/02_all_vDatetime-tzinfo-fix.patch
@@ -0,0 +1,30 @@
+From http://codespeak.net/pipermail/icalendar-dev/2009-July/000139.html:
+
+SUMMARY: The encoding mechanism of vDatetime handles tzinfo fields
+incorrectly (specifically with respect to daylight savings time).
+Attached is a simple patch that makes it work.
+
+DETAILS: Currently vDatetime.ical() tries to compute the utcoffset of
+the tzinfo, and then subtract that offset. This approach is valid,
+but the computation of the utcoffset is wrong, because it's done relative
+to datetime.now() instead of the actual datetime object (self.dt)
+to be converted. This is an issue for timezones whose utcoffset varies
+throughout the year, e.g., from daylight savings time.
+Replacing datetime.now() with self.dt would fix the code,
+but I opted to use the builtin 'asttimezone' method
+because it's slightly simpler.
+
+Submitted by Erik Demaine.
+===================================================================
+--- src/icalendar/prop.py.orig 2009-12-14 08:43:50.000000000 -0500
++++ src/icalendar/prop.py 2009-12-20 12:41:28.000000000 -0500
+@@ -309,8 +309,7 @@
+
+ def ical(self):
+ if self.dt.tzinfo:
+- utc_time = self.dt - self.dt.tzinfo.utcoffset(datetime.now())
+- return utc_time.strftime("%Y%m%dT%H%M%SZ")
++ return self.dt.astimezone (UTC).strftime("%Y%m%dT%H%M%SZ")
+ return self.dt.strftime("%Y%m%dT%H%M%S")
+
+ def from_ical(ical):