【发布时间】:2011-09-09 14:34:47
【问题描述】:
我正在编写一个 Plone 产品,它采用 iCalendar,将其拉入并创建 Plone Event 类型。我已经让这一切正常工作了,除了在一年的一半日期里,时间戳相差一个小时。
我的 iCalendar 提要将这些作为 UTC 时间戳传递:
DTSTART;VALUE=DATE:20110812T130000Z 应该是 America/New_York 时区的上午 9 点 DTEND;VALUE=DATE:20110812T160000Z 应该是 America/New_York 时区的中午 12 点
那些工作正常。这些不:
DTSTART;VALUE=DATE:20111225T175525Z 应该是下午 1:55,但它显示为下午 12:55 DTEND;VALUE=DATE:20111225T215525Z 应该是下午 5:55,但它显示为下午 4:55
从生成 iCalendar 提要的数据库到 iCalendar 生成器,再到 Zope 中存储的实际值,一切都是正确的。但是 Plone 在事件详情页面上显示不正确的本地时间。
我已经尝试在我的构建中设置“TZ America/New_York”,我已经尝试在 Zope 服务器上设置系统时钟,以查看转换是否会在“我们返回 EST 之后”神奇地发生。没有运气。
这里有几个例子可以说明问题:
正确显示事件,发生在 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: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
您可以看到它以 UTC 存储在 Zope 中,所以问题仅在于它的显示方式:
>>> app.Plone.events['ug-flyerfriday-172'].startDate
DateTime('2011/12/25 17:55:25 GMT+0')
【问题讨论】:
-
我不明白当前行为有什么问题。 EST 是 GMT-5,因此 DST 无效的日期应显示为比存储的 GMT 值早 5 小时,对吧?
-
@David Glick 你是完全正确的。我已经盯着这个太久了。 :/ 问题出在 iCalendar 生产者身上。
标签: python plone icalendar zope dst