From michael at smith-li.com Thu Jun 9 05:32:15 2011 From: michael at smith-li.com (Michael A. Smith) Date: Wed, 8 Jun 2011 23:32:15 -0400 Subject: [icalendar-dev] Daylight savings time bug Message-ID: Hi, I think I found a bug in how daylight savings time is being handled when it is *not* active. If you look at the code below, the DTEND value should be: 20111206T230000Z, but it's an hour off. >>> from icalendar import Event >>> from dateutil import tz >>> from datetime import datetime >>> >>> tzny = tz.gettz("America/New_York") >>> dtstart = datetime(2011,6,6,18,tzinfo=tzny) >>> dtend = dtstart.replace(month=12) >>> print "dtstart: %s" % dtstart dtstart: 2011-06-06 18:00:00-04:00 >>> print "dtend: %s" % dtend dtend: 2011-12-06 18:00:00-05:00 >>> >>> eny=Event() >>> eny.add('dtstart', dtstart) >>> eny.add('dtend', dtend) >>> >>> print "dtstart: %s" % dtstart dtstart: 2011-06-06 18:00:00-04:00 >>> print "dtend: %s" % dtend dtend: 2011-12-06 18:00:00-05:00 >>> print eny BEGIN:VEVENT DTEND;VALUE=DATE:20111206T220000Z DTSTART;VALUE=DATE:20110606T220000Z END:VEVENT ? Michael A. Smith a.k.a. kojiro From sappj at ieee.org Mon Jun 13 18:18:27 2011 From: sappj at ieee.org (Joe Sapp) Date: Mon, 13 Jun 2011 12:18:27 -0400 Subject: [icalendar-dev] Daylight savings time bug In-Reply-To: References: Message-ID: <4DF63853.2090406@ieee.org> On 06/08/2011 11:32 PM, Michael A. Smith wrote: > Hi, > > I think I found a bug in how daylight savings time is being handled > when it is *not* active. If you look at the code below, the DTEND > value should be: 20111206T230000Z, but it's an hour off. > >>>> from icalendar import Event >>>> from dateutil import tz >>>> from datetime import datetime >>>> >>>> tzny = tz.gettz("America/New_York") >>>> dtstart = datetime(2011,6,6,18,tzinfo=tzny) >>>> dtend = dtstart.replace(month=12) >>>> print "dtstart: %s" % dtstart > dtstart: 2011-06-06 18:00:00-04:00 >>>> print "dtend: %s" % dtend > dtend: 2011-12-06 18:00:00-05:00 >>>> >>>> eny=Event() >>>> eny.add('dtstart', dtstart) >>>> eny.add('dtend', dtend) >>>> >>>> print "dtstart: %s" % dtstart > dtstart: 2011-06-06 18:00:00-04:00 >>>> print "dtend: %s" % dtend > dtend: 2011-12-06 18:00:00-05:00 >>>> print eny > BEGIN:VEVENT > DTEND;VALUE=DATE:20111206T220000Z > DTSTART;VALUE=DATE:20110606T220000Z > END:VEVENT > It looks to me like you're right. Can you come up with a patch to icalendar? -- Joe Sapp