Skip to content

Commit

Permalink
Merge pull request #964 from owncloud/recalculate-exdate-timezone
Browse files Browse the repository at this point in the history
Fix for exdate timezone recalculations
  • Loading branch information
DeepDiver1975 authored Apr 30, 2019
2 parents ae8b52a + 9ea6bc6 commit 40e67c0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/app/models/veventModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ app.factory('VEvent', function(TimezoneService, FcEvent, SimpleEvent, ICalFactor

const exdateProp = new ICAL.Property('exdate', vevent);
exdateProp.setValues(exdates);
if (angular.isDefined(dtstart.timezone)) {
if (angular.isDefined(dtstart.zone) && dtstart.zone.tzid !== 'floating' &&
dtstart.zone.tzid !== 'UTC') {
exdateProp.setParameter('tzid', dtstart.zone.tzid);
} else if(angular.isDefined(dtstart.timezone)) {
exdateProp.setParameter('tzid', dtstart.timezone);
}

Expand Down
29 changes: 29 additions & 0 deletions tests/js/unit/models/veventModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2117,11 +2117,40 @@ RRULE:FREQ=DAILY
SEQUENCE:12
EXDATE;VALUE=DATE:20180920,20180925
END:VEVENT
END:VCALENDAR`;
const icsExDate3 = `BEGIN:VCALENDAR
PRODID:-//ownCloud calendar v1.6.2
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
CREATED:20190425T082646Z
DTSTAMP:20190425T085233Z
LAST-MODIFIED:20190425T085233Z
UID:QCHAJOMUPGK7T91TRSOGDJ
SUMMARY:test
CLASS:PUBLIC
STATUS:CONFIRMED
RRULE:FREQ=DAILY
SEQUENCE:20
DTSTART;TZID=Europe/Istanbul:20190417T000000
DTEND;TZID=Europe/Istanbul:20190417T010000
EXDATE;TZID=Europe/Istanbul:20190424T000000
END:VEVENT
BEGIN:VTIMEZONE
TZID:Europe/Istanbul
BEGIN:STANDARD
TZOFFSETFROM:+0300
TZOFFSETTO:+0300
TZNAME:+03
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE
END:VCALENDAR`;

var objectDataProvider = {
'should have unchanged exdates if format matches': {input: icsExDate1, sequence: 'SEQUENCE:2', exdate: 'EXDATE;VALUE=DATE:20180920'},
'should change exdates from date to date time with time zone': {input: icsExDate2, sequence: 'SEQUENCE:13', exdate: 'EXDATE;TZID=Europe/Berlin:20180920T173000,20180925T173000'},
'should have unchanged exdates if format matches and exdates has tzid': {input: icsExDate3, sequence: 'SEQUENCE:21', exdate: 'EXDATE;TZID=Europe/Istanbul:20190424T000000'},
};

using(objectDataProvider, function (data, description) {
Expand Down

0 comments on commit 40e67c0

Please sign in to comment.