Add time zone to ical
This commit is contained in:
parent
9dc216f30b
commit
a95dcc866f
2
Gemfile
2
Gemfile
|
@ -64,7 +64,7 @@ gem "rqrcode"
|
||||||
|
|
||||||
gem "draper"
|
gem "draper"
|
||||||
|
|
||||||
gem "icalendar"
|
gem "icalendar", require: ['icalendar', 'icalendar/tzinfo']
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "spring"
|
gem "spring"
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
<%
|
<%
|
||||||
cal = Icalendar::Calendar.new
|
cal = Icalendar::Calendar.new
|
||||||
|
cal.add_timezone(Time.zone.tzinfo.ical_timezone(Time.now))
|
||||||
|
|
||||||
@events.each do |event|
|
@events.each do |event|
|
||||||
next unless event&.slot&.starts_at
|
next unless event&.slot&.starts_at
|
||||||
|
|
||||||
cal.event do |ical_event|
|
cal.event do |ical_event|
|
||||||
ical_event.dtstart = event.slot.starts_at
|
ical_event.dtstart = Icalendar::Values::DateTime.new(event.slot.starts_at, 'tzid' => event.slot.starts_at.time_zone.tzinfo.identifier)
|
||||||
ical_event.dtend = event.slot.ends_at
|
ical_event.dtend = Icalendar::Values::DateTime.new(event.slot.ends_at, 'tzid' => event.slot.ends_at.time_zone.tzinfo.identifier)
|
||||||
ical_event.summary = event.title
|
ical_event.summary = event.title
|
||||||
ical_event.description = event.description
|
ical_event.description = event.description
|
||||||
ical_event.created = event.created_at
|
ical_event.created = Icalendar::Values::DateTime.new(event.created_at, 'tzid' => event.created_at.time_zone.tzinfo.identifier)
|
||||||
ical_event.last_modified = event.updated_at
|
ical_event.last_modified = Icalendar::Values::DateTime.new(event.updated_at, 'tzid' => event.updated_at.time_zone.tzinfo.identifier)
|
||||||
ical_event.location = event.slot.hall.name
|
ical_event.location = event.slot.hall.name
|
||||||
ical_event.url = "https://www.openfest.org/2019/bg/full-schedule-bg/#lecture-#{event.id}"
|
ical_event.url = "https://www.openfest.org/2019/bg/full-schedule-bg/#lecture-#{event.id}"
|
||||||
ical_event.alarm do |alarm|
|
ical_event.alarm do |alarm|
|
||||||
|
|
Loading…
Reference in New Issue