@nickcis/ical-generator
Advanced tools
Comparing version 1.6.0-1552772039 to 1.6.0-20190322194000
@@ -507,10 +507,2 @@ 'use strict'; | ||
if (_repeating.excludeTimezone) { | ||
if (!c._data.repeating.exclude) { | ||
throw '`repeating.excludeTimezone` must be used along with `repeating.exclude`!'; | ||
} | ||
c._data.repeating.excludeTimezone = _repeating.excludeTimezone; | ||
} | ||
return c; | ||
@@ -1017,5 +1009,5 @@ } | ||
} else { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'DTSTART', this._data.start, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'DTSTART', this._data.start, this._data) + '\r\n'; | ||
if (this._data.end) { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'DTEND', this._data.end, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'DTEND', this._data.end, this._data) + '\r\n'; | ||
} | ||
@@ -1065,14 +1057,5 @@ } | ||
} else { | ||
g += 'EXDATE'; | ||
if (this._data.repeating.excludeTimezone) { | ||
g += ';TZID=' + this._data.repeating.excludeTimezone + ':' + this._data.repeating.exclude.map(function (excludedDate) { | ||
// This isn't a 'floating' event because it has a timezone; | ||
// but we use it to omit the 'Z' UTC specifier in formatDate() | ||
return ICalTools.formatDate(_this._data.repeating.excludeTimezone, excludedDate, false, true); | ||
}).join(',') + '\r\n'; | ||
} else { | ||
g += ':' + this._data.repeating.exclude.map(function (excludedDate) { | ||
return ICalTools.formatDate(_this._calendar.timezone(), excludedDate); | ||
}).join(',') + '\r\n'; | ||
} | ||
g += 'EXDATE:' + this._data.repeating.exclude.map(function (excludedDate) { | ||
return ICalTools.formatDate(_this._calendar.timezone(), excludedDate); | ||
}).join(',') + '\r\n'; | ||
} | ||
@@ -1084,3 +1067,3 @@ } | ||
if (this._data.recurrenceId) { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'RECURRENCE-ID', this._data.recurrenceId, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'RECURRENCE-ID', this._data.recurrenceId, this._data) + '\r\n'; | ||
} | ||
@@ -1087,0 +1070,0 @@ |
{ | ||
"name": "@nickcis/ical-generator", | ||
"version": "1.6.0-1552772039", | ||
"description": "ical-generator is a small piece of code which generates ical calendar files", | ||
"version": "1.6.0-20190322194000", | ||
"author": "Sebastian Pekarek <mail@sebbo.net>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -339,4 +339,3 @@ # ical-generator | ||
bySetPos: 3, // repeat every 3rd sunday (will take the first element of the byDay array) | ||
exclude: [new Date('Dec 25 2013 00:00:00 UTC')], // exclude these dates | ||
excludeTimezone: 'Europe/Berlin' // timezone of exclude | ||
exclude: [new Date('Dec 25 2013 00:00:00 UTC')] // exclude these dates | ||
}); | ||
@@ -343,0 +342,0 @@ ``` |
@@ -505,10 +505,2 @@ 'use strict'; | ||
if (repeating.excludeTimezone) { | ||
if (!c._data.repeating.exclude) { | ||
throw '`repeating.excludeTimezone` must be used along with `repeating.exclude`!'; | ||
} | ||
c._data.repeating.excludeTimezone = repeating.excludeTimezone; | ||
} | ||
return c; | ||
@@ -987,5 +979,5 @@ } | ||
else { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'DTSTART', this._data.start, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'DTSTART', this._data.start, this._data) + '\r\n'; | ||
if (this._data.end) { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'DTEND', this._data.end, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'DTEND', this._data.end, this._data) + '\r\n'; | ||
} | ||
@@ -1036,15 +1028,5 @@ } | ||
else { | ||
g += 'EXDATE'; | ||
if (this._data.repeating.excludeTimezone) { | ||
g += ';TZID=' + this._data.repeating.excludeTimezone + ':' + this._data.repeating.exclude.map(excludedDate => { | ||
// This isn't a 'floating' event because it has a timezone; | ||
// but we use it to omit the 'Z' UTC specifier in formatDate() | ||
return ICalTools.formatDate(this._data.repeating.excludeTimezone, excludedDate, false, true); | ||
}).join(',') + '\r\n'; | ||
} | ||
else { | ||
g += ':' + this._data.repeating.exclude.map(excludedDate => { | ||
return ICalTools.formatDate(this._calendar.timezone(), excludedDate); | ||
}).join(',') + '\r\n'; | ||
} | ||
g += 'EXDATE:' + this._data.repeating.exclude.map(excludedDate => { | ||
return ICalTools.formatDate(this._calendar.timezone(), excludedDate); | ||
}).join(',') + '\r\n'; | ||
} | ||
@@ -1056,3 +1038,3 @@ } | ||
if (this._data.recurrenceId) { | ||
g += ICalTools.formatDateTZ(this._calendar.timezone(), 'RECURRENCE-ID', this._data.recurrenceId, this._data) + '\r\n'; | ||
g += ICalTools.formatDateTZ(this.timezone(), 'RECURRENCE-ID', this._data.recurrenceId, this._data) + '\r\n'; | ||
} | ||
@@ -1059,0 +1041,0 @@ |
@@ -87,2 +87,24 @@ 'use strict'; | ||
}); | ||
}); | ||
describe('Issue #154', function() { | ||
['DTSTART', 'DTEND', 'RECURRENCE-ID'].forEach(function (prop) { | ||
it(`it should correctly set ${prop} when using different timezone in calendar and event`, function() { | ||
const calendar = ical({ | ||
domain: 'sebbo.net', | ||
timezone: 'America/Buenos_Aires', | ||
events: [ | ||
{ | ||
start: new Date(1553219772000), | ||
end: new Date(1553219772000), | ||
recurrenceId: new Date(1553219772000), | ||
timezone: 'America/La_Paz', | ||
} | ||
] | ||
}); | ||
const str = calendar.toString(); | ||
assert.ok(str.indexOf(`${prop};TZID=America/La_Paz:20190321T215612`) > -1, str); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
334425
7968
734