开发者

How can I make Plone display events during DST with the correct time?

I'm writing a Plone product that takes iCalendar, pulls it in, and creates Plone Event types. I've got it all working perfectly, except that, for half of the year's dates, the timestamps are off by an hour.

My iCalendar feed is passing these as UTC timestamps:

DTSTART;VALUE=DATE:20110812T130000Z should be 9am in the America/New_York timezone DTEND;VALUE=DATE:20110812T160000Z should be 12noon in the America/New_York timezone

Those work fine. These don't:

DTSTART;VALUE=DATE:20111225T175525Z should be 1:55pm, but it's showing as 12:55pm DTEND;VALUE=DATE:20111225T215525Z should be 5:55pm, but it's showing as 4:55pm

How can I make Plone display events during DST with the correct time?

From the database that generates the iCalendar feed, to the iCalendar generator, to the actual values stored in Zope, everything is correct. But Plone displays the incorrect localtime on the event detail pages.

I've tried setting "TZ America/New_York" in my buildout, I've tried setting the system clock on the Zope server ahead to see if the conversion would magically happen "after we return to EST". No luck.

Here's a couple of examples that might illustrate the problem:

Correctly-Displaying Event, which takes place in EDT:

 BEGIN:VEVENT
DESCRIPTION:Flyer Fridays give you the opportunity to hear from professors
  in Communication Sciences & Disorders\, Education\, Management\, Nursing\
 , Physical Therapy\, Occupational Therapy or Visual & Performing Arts.  \n
 \nFaculty sessions begin at 9:15am (PLEASE CHOOSE ONE)\, followed by a 10a
 m campus tour and an 11am Freshmen information session.  After the day's e
 vents\, you're invited to join the Admissions staff for lunch.
DTEND;VALUE=DATE:20110812T16开发者_运维知识库0000Z
DTSTART;VALUE=DATE:20110812T130000Z
LOCATION:Nazareth College
SUMMARY:Flyer Friday - Management Info Session
UID:ug-flyerfriday-164
END:VEVENT

And, how it is stored in Zope:

>>> app.Plone.events['ug-flyerfriday-164'].startDate
DateTime('2011/08/12 13:00:00 GMT+0')

Incorrectly-displayed event, which takes place in EST:

BEGIN:VEVENT
DESCRIPTION:Fun with TZINFO Flyer Fridays give you the opportunity to hear
  from professors in Communication Sciences & Disorders\, Education\, Manag
 ement\, Nursing\, Physical Therapy\, Occupational Therapy or Visual & Perf
 orming Arts.  \n\nFaculty sessions begin at 9:15am (PLEASE CHOOSE ONE)\, f
 ollowed by a 10am campus tour and an 11am Freshmen information session.  A
 fter the day's events\, you're invited to join the Admissions staff for lu
 nch.
DTEND;VALUE=DATE:20111225T215525Z
DTSTART;VALUE=DATE:20111225T175525Z
LOCATION:Nazareth College
SUMMARY:Flyer Friday - Timezone Info Session
UID:ug-flyerfriday-172
END:VEVENT

And you can see it's stored in Zope with UTC, so the problem is only in how it's displayed:

>>> app.Plone.events['ug-flyerfriday-172'].startDate
DateTime('2011/12/25 17:55:25 GMT+0')


Try Time Zone Converter.

You are experimenting daylight saving time. This arises when you change the date.

Check one of the supposedly wrong dates:

DTSTART;VALUE=DATE:20111225T175525Z should be 1:55pm, but it's showing as 12:55pm and read the legend:

Daylight Saving Time is not in effect on this date/time in GMT Daylight

Saving Time is not in effect on this date/time in America/New_York

And then check one of the no-problem dates:

DTSTART;VALUE=DATE:20110812T130000Z should be 9am in the America/New_York timezone with this legend:

Daylight Saving Time is not in effect on this date/time in GMT Daylight

Saving Time is in effect on this date/time in America/New_York

Here you can see the Dailyght Saving Time details for America/New_York timezone: http://www.timezoneconverter.com/cgi-bin/zoneinfo.tzc?s=default&tz=America/New_York

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜