1

アメリカ/デンバーのタイムゾーンの解析を突然終了するicalフィードを解析していますが、他のタイムゾーンは機能します。私はztinfogemと最新のricalgemを使用しています。これが失敗を示すサンプルです。

require 'tzinfo'
require 'ri_cal'

az = <<AZ
BEGIN:VCALENDAR
PRODID:-//SuperSaaS//Super Schedule//EN
METHOD:PUBLISH
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:Fluid Meeting Space
X-WR-TIMEZONE:America/Phoenix
X-WR-RELCALID:40409
BEGIN:VTIMEZONE
TZID:America/Phoenix
BEGIN:STANDARD
TZOFFSETFROM:-0600
TZOFFSETTO:-0700
DTSTART:19671029T010000
RDATE:19671029T010000
TZNAME:MST
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:1641738@supersaas.com
DTSTAMP:20110519T195014Z
DTSTART;TZID=America/Phoenix:20110428T120000
DTEND;TZID=America/Phoenix:20110428T130000
SUMMARY:Dusty
DESCRIPTION:Test Meeting
CREATED:20110428T210637Z
LAST-MODIFIED:20110428T210637Z
URL:http://www.supersaas.com/schedule/red27/Fluid_Meeting_Space?year=2011&m
 onth=4&day=28
END:VEVENT
END:VCALENDAR       
AZ

mst = <<MST
BEGIN:VCALENDAR
PRODID:-//SuperSaaS//Super Schedule//EN
METHOD:PUBLISH
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:Fluid Meeting Space
X-WR-TIMEZONE:America/Denver
X-WR-RELCALID:40409
BEGIN:VTIMEZONE
TZID:America/Denver
BEGIN:DAYLIGHT
TZOFFSETFROM:-0700
TZOFFSETTO:-0600
DTSTART:20110313T030000
RDATE:20110313T030000
TZNAME:MDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:1641738@supersaas.com
DTSTAMP:20110519T192544Z
DTSTART;TZID=America/Denver:20110428T120000
DTEND;TZID=America/Denver:20110428T130000
SUMMARY:Dusty
DESCRIPTION:Test Meeting
CREATED:20110428T210637Z
LAST-MODIFIED:20110428T210637Z
URL:http://www.supersaas.com/schedule/red27/Fluid_Meeting_Space?year=2011&m
 onth=4&day=28
END:VEVENT
END:VCALENDAR
MST

def show(vcal)
    components = RiCal.parse_string(vcal.strip)

    components.each do |cal|
        puts cal.events.count
        cal.events.each do |e|
            puts "UID: #{e.inspect}"
            puts "Start: #{e.dtstart} "
            puts "End: #{e.dtend} "
            puts "******************************"   
        end
    end
end

show(az)

show(mst)
4

1 に答える 1

0

ここでチケットを作成しました:http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/36-you-have-a-nil-object-when-you-didnt-expect-it-dtstart#ticket- 36-3

問題は、icalフィードにSTANDARDコンポーネントがなく、DAYLIGHTだけである場合のようです。

module RiCal
    class Component
        class Timezone < Component
            def periods_for_local(local)
                local = local.to_ri_cal_date_time_value
                candidate_standard = last_before_local(standard, local)
                candidate_daylight = last_before_local(daylight, local)
                if candidate_daylight && candidate_daylight.swallows_local?(local, candidate_standard)
                    []  # Invalid local time
                elsif candidate_standard
                    if candidate_daylight
                        if candidate_daylight.dtstart > candidate_standard.dtstart
                            [candidate_daylight]
                        elsif candidate_standard.ambiguous_local?(local)
                            [candidate_daylight, candidate_standard]
                        else
                            [candidate_standard].compact
                        end
                    else
                        [candidate_standard].compact
                    end
                elsif candidate_daylight
                    [candidate_daylight]
                end
            end
        end
    end
end
于 2011-05-20T16:53:01.410 に答える