2011-06-06 69 views
2

我正在寫一個需要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

回答

2

嘗試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

相關問題