From b87ada474ff1b73455f070a25aea5d98c4ca0884 Mon Sep 17 00:00:00 2001 From: Ben Rexin Date: Wed, 13 Nov 2024 15:14:53 +0100 Subject: [PATCH] fix: mark ics start and end time as non floating RFC-5545 Section 3.3.5. requires UTC timestamps to end with Z to not be considered a floating timestamp --- app/helpers/ical_helper.rb | 4 ++-- spec/helpers/ical_helper_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/ical_helper.rb b/app/helpers/ical_helper.rb index e739694a..c37828aa 100644 --- a/app/helpers/ical_helper.rb +++ b/app/helpers/ical_helper.rb @@ -7,8 +7,8 @@ def icalendar(*events) cal.event do |item| item.summary = event.name item.description = "#{event.description} #{event_url(event)}" - item.dtstart = event.date.utc - item.dtend = event.end_date.utc + item.dtstart = Icalendar::Values::DateTime.new event.date.utc, tzid: 'UTC' + item.dtend = Icalendar::Values::DateTime.new event.end_date.utc, tzid: 'UTC' item.url = event_url(event) item.location = event.location.name if event.location end diff --git a/spec/helpers/ical_helper_spec.rb b/spec/helpers/ical_helper_spec.rb index 4976e14c..16e7d6eb 100644 --- a/spec/helpers/ical_helper_spec.rb +++ b/spec/helpers/ical_helper_spec.rb @@ -7,7 +7,7 @@ helper.icalendar(event).to_s.tap do |it| expect(it).to match('http://test.host/events/awesome-ottawa-123') expect(it).to match('SUMMARY:awesome ottawa') - expect(it).to match('DTSTART:20111111T170000') + expect(it).to match('DTSTART:20111111T170000Z') end end