Timezones are globally added to the ical export

This commit is contained in:
echarp 2019-04-27 15:12:42 +02:00
parent 999f947aa4
commit 6008770a9d

View File

@ -1,8 +1,14 @@
:ruby :ruby
require 'icalendar/tzinfo'
# Create a calendar with an event (standard method) # Create a calendar with an event (standard method)
cal = Icalendar::Calendar.new cal = Icalendar::Calendar.new
@events.each do |event| @events.each do |event|
tzid = event.region.tzid tzid = event.region.tzid
tz = TZInfo::Timezone.get tzid
timezone = tz.ical_timezone event.start_time
cal.add_timezone timezone
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
e.uid = "#{event.id}@#{request.domain}" e.uid = "#{event.id}@#{request.domain}"