Class: TZInfo::TimezoneTransitionInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/icalendar/tzinfo.rb

Instance Method Summary collapse

Instance Method Details

#dtstartObject



78
79
80
# File 'lib/icalendar/tzinfo.rb', line 78

def dtstart
    local_start.to_datetime.strftime("%Y%m%dT%H%M%S")
end

#offset_fromObject



57
58
59
60
# File 'lib/icalendar/tzinfo.rb', line 57

def offset_from
    a = previous_offset.utc_total_offset
    sprintf("%2.2d%2.2d", (a / 3600).to_i, ((a / 60) % 60).to_i)
end

#offset_toObject



62
63
64
65
# File 'lib/icalendar/tzinfo.rb', line 62

def offset_to
    a = offset.utc_total_offset
    sprintf("%2.2d%2.2d", (a / 3600).to_i, ((a / 60) % 60).to_i)
end

#rruleObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/icalendar/tzinfo.rb', line 67

def rrule 
    start = local_start.to_datetime
    # this is somewhat of a hack, but seems to work ok
    [sprintf(
            "FREQ=YEARLY;BYMONTH=%d;BYDAY=%d%s",
            start.month, 
            ((start.day - 1)/ 7).to_i + 1,
            start.strftime("%a").upcase[0,2]
            )]
end