OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#53788] .ics calendar object does not account for daylight savings time loads incorrectly in MS Outlook (#15246)
Mir Bhatiab83cfb2446b0
diff --git a/modules/meeting/app/services/meetings/ical_service.rb b/modules/meeting/app/services/meetings/ical_service.rbindex 9ef87dc81b7..e47c60b31de 100644--- a/modules/meeting/app/services/meetings/ical_service.rb+++ b/modules/meeting/app/services/meetings/ical_service.rb@@ -73,9 +73,13 @@ module Meetingsdef ical_event(&)calendar = ::Icalendar::Calendar.new+ ical_timezone = @timezone.tzinfo.ical_timezone meeting.start_time+ calendar.add_timezone ical_timezone+calendar.event(&)calendar.publish+calendar.to_icalenddiff --git a/modules/meeting/spec/services/meetings/ical_service_spec.rb b/modules/meeting/spec/services/meetings/ical_service_spec.rbindex 56aad869dc5..3fbba0ffe0b 100644--- a/modules/meeting/spec/services/meetings/ical_service_spec.rb+++ b/modules/meeting/spec/services/meetings/ical_service_spec.rb@@ -28,8 +28,14 @@require "spec_helper"-RSpec.describe Meetings::ICalService, type: :model do- shared_let(:user) { create(:user, firstname: "Bob", lastname: "Barker", mail: "[email protected]") }+RSpec.describe Meetings::ICalService, type: :model do # rubocop:disable RSpec/SpecFilePathFormat+ shared_let(:user) do+ create(:user, firstname: "Bob", lastname: "Barker", mail: "[email protected]").tap do |u|+ u.pref[:time_zone] = "America/New_York"++ u.save!+ end+ endshared_let(:user2) { create(:user, firstname: "Foo", lastname: "Fooer", mail: "[email protected]") }shared_let(:project) { create(:project, name: "My Project") }@@ -50,7 +56,9 @@ RSpec.describe Meetings::ICalService, type: :model dolet(:service) { described_class.new(user:, meeting:) }let(:result) { service.call.result }- subject(:entry) { Icalendar::Event.parse(result).first }+ let(:entry) { Icalendar::Event.parse(result).first }+ let(:standard_zone) { Icalendar::Calendar.parse(result).first.timezones.first.standards.first }+ let(:daylight_zone) { Icalendar::Calendar.parse(result).first.timezones.first.daylights.first }describe "#call" doit "returns a success" do@@ -81,6 +89,14 @@ RSpec.describe Meetings::ICalService, type: :model doexpect(entry.location).to eq(meeting.location.presence)expect(entry.dtstart).to eq Time.zone.parse("2021-01-19T10:00:00Z").in_time_zone("Europe/Berlin")expect(entry.dtend).to eq (Time.zone.parse("2021-01-19T10:00:00Z") + 1.hour).in_time_zone("Europe/Berlin")++ # do autogenerated ical timezone definitions match real DST switch times?+ standard = standard_zone.dtstart.to_time+ real_standard = Time.zone.parse("01-11-2020 01:00:00")+ daylight = daylight_zone.dtstart.to_time+ real_daylight = Time.zone.parse("14-03-2021 03:00:00")+ expect(standard.strftime("%a, %d %b %Y %H:%M:%S")).to eq (real_standard.strftime("%a, %d %b %Y %H:%M:%S"))+ expect(daylight.strftime("%a, %d %b %Y %H:%M:%S")).to eq (real_daylight.strftime("%a, %d %b %Y %H:%M:%S"))endendend