Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expansion of Etc/GMT is affected by system timezone #408

Closed
marcoancona opened this issue Nov 1, 2019 · 2 comments
Closed

Expansion of Etc/GMT is affected by system timezone #408

marcoancona opened this issue Nov 1, 2019 · 2 comments

Comments

@marcoancona
Copy link
Contributor

marcoancona commented Nov 1, 2019

Today I run into a strange behavior that seems like a bug to me. I assume the result of a recurrent rule expansion should not be affected by the system timezone. However it is, when the event timezone is "Etc/GMT" (and maybe some other?)

Steps to reproduce.
Save this node script:

const ICAL = require('ical.js');

const ics = `
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
SUMMARY:New Event
TRANSP:OPAQUE
CLASS:PUBLIC
DTSTAMP:20191101T103936Z
DTSTART;TZID=Etc/GMT:20191109T110000
DTEND;TZID=Etc/GMT:20191109T120000
CREATED:20191101T095430Z
LAST-MODIFIED:20191101T103935Z
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=SA
SEQUENCE:0
END:VEVENT
END:VCALENDAR
`;

var jcalData = ICAL.parse(ics);
var vcalendar = new ICAL.Component(jcalData);
var vevent = vcalendar.getFirstSubcomponent('vevent');
var expand = new ICAL.RecurExpansion({
	component: vevent,
	dtstart: vevent.getFirstPropertyValue('dtstart')
});
console.log(expand.next().toJSDate());

Run twice

> TZ="UTC" node test.js 
2019-11-09T11:00:00.000Z  // < correct!
> TZ="Europe/Amsterdam" node test.js 
startDate: 2019-11-09T10:00:00.000Z  // < wrong!

Notice that, if the event timezone is different, the result of the expansion is independent of the system timezone (as it should since the output dates are UTC). So, for example, with

DTSTART;TZID=Europe/Athens:20191109T110000
DTEND;TZID=Europe/Athens:20191109T120000

the result is correct

> TZ="UTC" node test.js 
2019-11-09T09:00:00.000Z
> TZ="Europe/Amsterdam" node test.js 
2019-11-09T09:00:00.000Z
@kewisch kewisch added the bug label Apr 15, 2024
@kewisch
Copy link
Owner

kewisch commented May 1, 2024

I'm not able to reproduce this on node v21.7.2. Is this still an issue for you?

@kewisch kewisch added needinfo More information has been requested and removed bug labels May 1, 2024
Copy link

github-actions bot commented Jun 1, 2024

It looks like we haven't heard back on this issue, therefore we are closing this issue. If this problem persists in the latest version of ical.js, please re-open this issue.

@github-actions github-actions bot closed this as completed Jun 1, 2024
@github-actions github-actions bot removed the needinfo More information has been requested label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants