Skip to content

Commit 4481425

Browse files
authored
Merge pull request #1055 from rughh/fix/correct_ical_start_times
fix: correct ical start/end times
2 parents 5e39a81 + 6d6da92 commit 4481425

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/helpers/ical_helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def icalendar(*events)
77
cal.event do |item|
88
item.summary = event.name
99
item.description = "#{event.description} #{event_url(event)}"
10-
item.dtstart = event.date
11-
item.dtend = event.end_date
10+
item.dtstart = event.date.utc
11+
item.dtend = event.end_date.utc
1212
item.url = event_url(event)
1313
item.location = event.location.name if event.location
1414
end

spec/helpers/ical_helper_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
require 'spec_helper'
22

33
describe IcalHelper do
4-
let(:event) { build(:event, id: 123, name: 'awesome ottawa', date: '11.11.2011 19:00 UTC') }
4+
let(:event) { build(:event, id: 123, name: 'awesome ottawa', date: '11.11.2011 19:00 +02:00') }
55

66
it 'creates a valid icalendar event' do
77
helper.icalendar(event).to_s.tap do |it|
8-
expect(it).to match('BEGIN:VCALENDAR')
98
expect(it).to match('http://test.host/events/awesome-ottawa-123')
109
expect(it).to match('SUMMARY:awesome ottawa')
10+
expect(it).to match('DTSTART:20111111T170000')
1111
end
1212
end
1313

0 commit comments

Comments
 (0)