Only add a timezone once to an ical
This commit is contained in:
parent
e2f9e707c3
commit
4fb494d393
@ -5,6 +5,8 @@
|
|||||||
cal = Icalendar::Calendar.new
|
cal = Icalendar::Calendar.new
|
||||||
@events.each do |event|
|
@events.each do |event|
|
||||||
tzid = event.region.tzid
|
tzid = event.region.tzid
|
||||||
|
if cal.timezones.none? { |t| tzid == t.tzid }
|
||||||
|
# Only add this zone once
|
||||||
begin
|
begin
|
||||||
tz = TZInfo::Timezone.get tzid
|
tz = TZInfo::Timezone.get tzid
|
||||||
timezone = tz.ical_timezone event.start_time
|
timezone = tz.ical_timezone event.start_time
|
||||||
@ -12,6 +14,7 @@
|
|||||||
rescue TZInfo::InvalidTimezoneIdentifier
|
rescue TZInfo::InvalidTimezoneIdentifier
|
||||||
# No need to add this tz
|
# No need to add this tz
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
cal.event do |e|
|
cal.event do |e|
|
||||||
e.dtstamp = Icalendar::Values::DateTime.new event.decision_time, tzid: tzid
|
e.dtstamp = Icalendar::Values::DateTime.new event.decision_time, tzid: tzid
|
||||||
|
Loading…
Reference in New Issue
Block a user