如何使用正确的时间在DST期间制作Plone显示事件?

如何使用正确的时间在DST期间制作Plone显示事件?

问题描述:

我正在写一个需要iCalendar的Plone产品,将它拉入并创建Plone事件类型。我已经完成了所有工作,除了在一年中的一半时间里,时间戳已经停止了一个小时。如何使用正确的时间在DST期间制作Plone显示事件?

我的iCalendar进料通过这些为UTC时间戳:

DTSTART; VALUE = DATE:20110812T130000Z应该在美国/纽约时区 DTEND上午09点; VALUE = DATE:20110812T160000Z应该在美国/纽约中午12点时区

那些工作正常。这些不:

DTSTART; VALUE = DATE:20111225T175525Z应该是下午1:55,但它显示为下午12:55 DTEND; VALUE = DATE:20111225T215525Z应该是下午5:55,但它显示为下午4:55

Screenshot of Plone showing incorrect EDT event time 从生成iCalendar订阅源的数据库到iCalendar生成器,到存储在Zope中的实际值,一切都是正确的。但Plone在事件详细信息页面上显示不正确的本地时间。

我试过在我的构建中设置“TZ America/New_York”,我试着在Zope服务器上设置系统时钟,看看转换是否会在我们返回EST后奇迹般发生。没有运气。

这里有几个例子,可能说明这个问题:

正确,显示事件,其中发生在美国东部时间:

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:20110812T160000Z 
DTSTART;VALUE=DATE:20110812T130000Z 
LOCATION:Nazareth College 
SUMMARY:Flyer Friday - Management Info Session 
UID:ug-flyerfriday-164 
END:VEVENT 

而且,它是如何被存储在Zope中:

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

错误显示的事件发生在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 

而且你可以看到它的存储在Zope中与UTC,所以这个问题是只有在它是如何显示:

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

我不明白这有什么错的当前行为。东部时区是格林威治标准时间5,因此从DST不生效的日期应该显示为比存储的GMT值早5小时,情况就是这样,对吗? – 2011-06-07 06:05:32

+0

@David Glick你是完全正确的。我一直盯着这太久。 :/问题是与iCalendar生产者。 – kojiro 2011-06-07 13:27:19

尝试Time Zone Converter

您正在试验夏令时。 这在您更改日期时出现。

检查理应错日期之一:

DTSTART;VALUE=DATE:20111225T175525Z should be 1:55pm, but it's showing as 12:55pm 读的传说:

夏令时生效 在格林尼治标准时间夏令

此日期/时间

节省时间不是这个日期/时间在这个 有效美国/ New_York

然后检查无问题的日期之一:

DTSTART;VALUE=DATE:20110812T130000Z should be 9am in the America/New_York timezone这个传说:在GMT日光

夏令时生效 在此日期/时间

保存时间对此产生影响 在美国的日期/时间/ New_York

在这里你可以看到美国/纽约时区的Dailyght节约时间细节: http://www.timezoneconverter.com/cgi-bin/zoneinfo.tzc?s=default&tz=America/New_York