pedrofuentes / stream-deck-ical

An iCal Plugin for elgato Stream Deck
https://pedrofuentes.com
MIT License
26 stars 13 forks source link

Incorrect timezone conversion #12

Open kc-sn opened 2 years ago

kc-sn commented 2 years ago

The plugin appears to ignore the timezone of the calendar user and calculates time until meeting as if the meeting time were local. I've included the headers from my .ical, and the beginning of a VEVENT

BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:nobody@noone.com
X-WR-TIMEZONE:America/Chicago
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20220317T150000
DTEND;TZID=America/Los_Angeles:20220317T154500
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=TH

I've tried building using the most recent timezone.js from the author (along with a version which has an open PR on that repo), along with a current open PR and the problem still persists. Any ideas here?

I recall using this plugin successfully, but that was with an organization whose calendar was default to GMT/Zulu. The current organization I work for has their calendar default to PST (which is pretty obvious in the above ical).

StephKoenig commented 2 years ago

I have the issue. I'm in the UK and all meets are an extr ahour away accoring to the plugin. This is largely becuase the US and UK are now closer by an extra hour (later this year we'll been future away by an extra hour).

FWIW. These two times of year are chaos for transalatlatic time related stuff and such an annoying thing to code around.

GolfedMan commented 2 years ago

I am having this same problem. :) It is good to know others share the frustration!

Tableautin commented 2 years ago

I also got the same problem here. I got an offset of 1 hour. Currently it seems that the plugin does not use the correct offset if daylight saving is active. Currently I am in Germany/Berlin timezone with daylight saving on (+02:00). Here is a sample start of my iCal: BEGIN:VCALENDAR METHOD:PUBLISH PRODID:Microsoft Exchange Server 2010 VERSION:2.0 X-WR-CALNAME:Kalender BEGIN:VTIMEZONE TZID:W. Europe Standard Time BEGIN:STANDARD DTSTART:16010101T030000 TZOFFSETFROM:+0200 TZOFFSETTO:+0100 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:+0100 TZOFFSETTO:+0200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 END:DAYLIGHT END:VTIMEZONE BEGIN:VTIMEZONE TZID:Eastern Standard Time BEGIN:STANDARD DTSTART:16010101T020000 TZOFFSETFROM:-0400 TZOFFSETTO:-0500 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:-0500 TZOFFSETTO:-0400 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT

spitfire commented 1 year ago

same here, but we have not changed to winter time yet, neither has anybody else. So I guess it doesn't work in summer time?

DennisGaida commented 1 year ago

Maybe @pedrofuentes can chime in? Probably the same issue as https://github.com/pedrofuentes/stream-deck-ical/issues/1. I see the timezone is being converted / checked here: https://github.com/pedrofuentes/stream-deck-ical/blob/a596732a6e6bed0669a83dc2b3bd77a9de5cc264/src/js/lib/ical.js#L158C1-L158C78, specifically it is this line here: https://github.com/pedrofuentes/stream-deck-ical/blob/a596732a6e6bed0669a83dc2b3bd77a9de5cc264/src/js/lib/ical.js#L162C43-L162C43 that does the wrong conversion.

I have the same problem: Computer time zone as well as the ICAL are in the same time zone (W. Europe Standard Time), appointment e.g. (for an appointment from 13:00 - 13:30):

DTSTART;TZID=W. Europe Standard Time:20231025T130000
DTEND;TZID=W. Europe Standard Time:20231025T133000

But it is displayed as +1 hour in the future (14:00 - 14:30).

DennisGaida commented 1 year ago

Actually https://github.com/pedrofuentes/stream-deck-ical/issues/1#issuecomment-786293794 is already the solution (from 2021).

In my case Outlook/Exchange saves the timezone as W. Europe Standard Time which is abbreviated to WEDT. WEDT or WET is the winter timezone in a lot of Europe - Outside of Windows(?) this is called CET or CEDT. W. Europe Standard Time actually is the wrong timezone currently, it would actually be W. Europe Summer Time aka summer time aka WEST/CEST.

Windows just as Outlook/Exchange does not show this special summertime though, it just implies that we know it currently is summer time in some parts of the world. It always keeps the base time zone (WEDT/CET). If you are on Windows and in a region affected by summertime, you can check yourself looking into your Windows time zone settings - it shows "UTC+1" which is wrong, since it currently would be "UTC+2" in the summer time - but it adjusts the time zone automagically for summer.

Outlook/Exchange does tell us in the beginning of the iCal file though:

BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE

It tells us exactly when daylight time (summer time) starts and ends (see DTSTART timestamp). A good visual overview when summertime starts and ends you can find here: https://www.timeanddate.com/time/zone/germany/berlin.
It also tells us the offset for this timeframe (TZOFFSETFROM/TZOFFSETTO): In daylight/summer the offset is +2, in winter it is +1 (+1 being the "default" for the time zone).

Unfortunately the used library (as explained in #1) doesn't currently use this timezone (VTIMEZONE) information (or knows about summer times itself) and hence just can't deal with summer time / daylight savings time. It takes the (incorrect) information from the iCal file and converts/displays the time "correctly" as-in it uses the information in the iCal file for the appointment, but forgets about those summertime offset information the iCal file also provides.