sam-github / vpim

vCard and iCalendar support for ruby
http://vpim.rubyforge.org/
Other
142 stars 69 forks source link

Vpim::Icalendar incorrectly decoding `US/Pacific` timezone events during DST #21

Closed scottrblock closed 8 months ago

scottrblock commented 6 years ago

Given a test.ics file with the following VTIMEZONE defined:

BEGIN:VTIMEZONE
TZID:US/Pacific
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
DTSTART:20070311T020000
TZNAME:PDT
TZOFFSETTO:-0700
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
DTSTART:20071104T020000
TZNAME:PST
TZOFFSETTO:-0800
END:STANDARD
END:VTIMEZONE

and a first event such as:

BEGIN:VEVENT
SUMMARY:Redacted
PRIORITY:5
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
TRANSP:OPAQUE
UID:redacted
DTSTART;TZID=US/Pacific:20180626T120000
SEQUENCE:0
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
STATUS:CONFIRMED
DTSTAMP:20180918T165239Z
CREATED:20180918T165240Z
DTEND;TZID=US/Pacific:20180626T123000
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
DESCRIPTION:Redacted
END:VEVENT

If I do

file = open('test.ics')
cal = Vpim::Icalendar.decode(file).first
all_events = cal.events {}.to_a
first_event = all_events.first
timezone_of_first_event = first_event.properties.find { |f| f.name? 'DTSTART' }.pvalue('TZID')

As indicated by the DAYLIGHT rule in VTIMEZONE in this .ics file, I'd expect timezone_of_first_event to be Pacific Daylight Time, but it is Pacific Standard Time

sam-github commented 8 months ago

VTIMEZONE isn't supported by vPim. It uses system/ruby timezone definitions. Maybe someone will support VTIMEZONE some day.