Manage offset without a specific name

This commit is contained in:
echarp 2019-04-27 15:39:06 +02:00
parent 6008770a9d
commit e2f9e707c3
1 changed files with 7 additions and 3 deletions

View File

@ -5,9 +5,13 @@
cal = Icalendar::Calendar.new
@events.each do |event|
tzid = event.region.tzid
tz = TZInfo::Timezone.get tzid
timezone = tz.ical_timezone event.start_time
cal.add_timezone timezone
begin
tz = TZInfo::Timezone.get tzid
timezone = tz.ical_timezone event.start_time
cal.add_timezone timezone
rescue TZInfo::InvalidTimezoneIdentifier
# No need to add this tz
end
cal.event do |e|
e.dtstamp = Icalendar::Values::DateTime.new event.decision_time, tzid: tzid