Skip to content

Commit

Permalink
remove zulu timezone string in case TZID is added (conforms to RFC5545).
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Nov 1, 2024
1 parent 0187b97 commit 8614154
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 55 deletions.
5 changes: 3 additions & 2 deletions ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,11 @@ module.exports = {
if (curr.start.tz) {
const tz = getTimeZone(curr.start.tz);
// If a timezone is provided, rrule requires the time to be local
// but without Z suffix (cf. RFC5545, 3.3.5)
const adjustedTimeString = curr.start
.toLocaleString('sv', {timeZone: tz})
.toLocaleString('sv-SE', {timeZone: tz}) // 'sv-SE' outputs 'YYYY-MM-DD' date format
.replace(/ /g, 'T')
.replace(/[-:]/g, '');
.replace(/[-:Z]/g, '');
rule += `;DTSTART;TZID=${tz}:${adjustedTimeString}`;
} else {
rule += `;DTSTART=${curr.start.toISOString().replace(/[-:]/g, '')}`;
Expand Down
105 changes: 53 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-ical",
"version": "0.20.0",
"version": "0.20.1",
"main": "node-ical.js",
"types": "node-ical.d.ts",
"description": "NodeJS class for parsing iCalendar/ICS files",
Expand Down

0 comments on commit 8614154

Please sign in to comment.