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

Calendar entries are displayed in inviter's timezone #42

Open
kjendal opened this issue Jun 29, 2020 · 2 comments
Open

Calendar entries are displayed in inviter's timezone #42

kjendal opened this issue Jun 29, 2020 · 2 comments

Comments

@kjendal
Copy link

kjendal commented Jun 29, 2020

I'm using icals published from Office365. Events are shown in the originators timezone (not local timezone).
Using latest release. Cloned 6/28/2020.

@kjendal
Copy link
Author

kjendal commented Jun 29, 2020

After some additional testing, it looks like the timezone is ignored and the time is used and local timezone is assumed.

My timezone is US EST. Calendar entries with
DTSTART;TZID=Eastern Standard Time:20200610T070000
DTEND;TZID=Eastern Standard Time:20200610T083000
are displayed correctly.

Here is a snippet of the ICS that is related to the problem:

BEGIN:VEVENT
UID:D08BB6CB0CBB4600A25486726835A759HLLORA
SUMMARY:[EXTERNAL]TC Monthly Telechat meeting
DTSTART;TZID=America/Los_Angeles:20200603T070000
DTEND;TZID=America/Los_Angeles:20200603T080000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20200629T131911Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0

...

@kjendal
Copy link
Author

kjendal commented Jul 3, 2020

I have this working now, but its a bit of a hack. For those interested:
ical.js does not handle timezones at all to address this, start with the patch from https://github.com/yyolk/node-ical-improved but support timeformats without 'Z' notation (UTC)

//typical RFC date-time format
      var comps = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/.exec(val);
      if (comps !== null) {
        if (comps[7] == 'Z'){ // GMT
          //newDate = new Date(Date.UTC(
            //parseInt(comps[1], 10),
            //parseInt(comps[2], 10)-1,
            //parseInt(comps[3], 10),
            //parseInt(comps[4], 10),
            //parseInt(comps[5], 10),
            //parseInt(comps[6], 10 )
          //));
          // TODO add tz
        } else {
          //newDate = new Date(
            //parseInt(comps[1], 10),
            //parseInt(comps[2], 10)-1,
            //parseInt(comps[3], 10),
            //parseInt(comps[4], 10),
            //parseInt(comps[5], 10),
            //parseInt(comps[6], 10)
          //);            
        }
        newDate = require('moment-timezone').tz(val.toString(), (parseParams(params).TZID || '')).tz('America/New_York').toDate();
        newDate = addTZ(newDate, params);
    }

Also, Outlook (at least) uses its own (apparently) TZID notation. The few that I tried need to be added to the timezone data from moment-timezone:

 // link some timezones for MS Outlook iCal
      var moment = require('moment-timezone');
        moment.tz.link([
        'America/New_York|Eastern Standard Time',
        'America/New_York|Eastern Daylight Time',
        'America/Chicago|Central Standard Time',
        'America/Chicago|Central Daylight Time',
        'America/Denver|Mountain Standard Time',
        'America/Denver|Mountain Daylight Time',
        'America/Los_Angeles|Pacific Standard Time',
        'America/Los_Angeles|Pacific Daylight Time',
        'Europe/Brussels|W. Europe Standard Time'
        ]);

I'm sure there is a better way to do this, but at least it is working...

I have a complete list outlook/MS timezone names to moment-timezone mappings if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants