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

Timezones are not converted to calendars' own timezone setting #294

Closed
Gewerd-Strauss opened this issue Nov 15, 2022 · 3 comments
Closed

Comments

@Gewerd-Strauss
Copy link

Hello,

I am encountering issues when adding an iCal-calendar containing events from different timezones.
The ical-file used during this issue can be found here.
For reference, I live in Germany, CEST/GMT+2/GMT+1 (summer/winter).

The Data

Below, you can see the twitch streaming schedule of Critical Role, an USA-based twitch channel. Especially note the time is in the middle of the night, because twitch displays the schedule in your local timezone. Note that in the browser, the time of the next stream is depending on your timezone, and that twitch has correctly established my timezone (GMT+1, we are in winter time here in germany).
grafik

This website is a general reference for checking when the next stream occurs depending on your timezone; and on it is stated that CR streams at 7PM pacific. Below you can see that 7-11 PM pacific correlates to 4-8 AM CEST/CET
grafik

Now, twitch allows retrieval of the schedule via api, which will return, for this very event, this data:

BEGIN:VEVENT
UID:35fcc0f2-2d6f-4858-94c8-ca3cf6fbc2c5
DTSTAMP:20221114T234409Z
DTSTART;TZID=/America/New_York:20221117T190000
DTEND;TZID=/America/New_York:20221117T230000
SUMMARY:The Mighty Nein Reunited (Part 1)
DESCRIPTION:Dungeons & Dragons.
CATEGORIES:Dungeons & Dragons
END:VEVENT

It is important to know that the timezone of DTSTART and DTEND is NOT relative to the person requesting the API-call. It might be relative to the channel's location, but for that I have not had enough samples I could check yet. I can only assume because it fits in this case, as well as for all the other cases I checked so far (but those are streamers within my own timezone, so its not verifiable yet).

Here is the screenshot of the resulting calendar generated by this script:
grafik

And finally, this is the result of adding the ical directly from URL in google calendar, the native way - at the expense of unpredictable updates:
grafik

What does this mean?

It seems for a calendar added by this script, the timezone of an event is not taken into account or is not converted to the timezone set in the calendar's settings properly.
grafik

To be clear:

Event Expected/Native Import from URL GAS-ICS-Sync Timestamp of iCal_File
The Mighty Nein Reunited (Part 1) Friday, 18 November, 01:00 - 05:00 Thursday, 17 November, 19:00 - 23:00 DTSTART;TZID=/America/New_York:20221117T190000 |||| DTEND; DTEND;TZID=/America/New_York:20221117T230000

Script Settings

The settings are pretty standard:

var howFrequent = 5;                  // What interval (minutes) to run this script on to check for new events
var onlyFutureEvents = false;          // If you turn this to "true", past events will not be synced (this will also removed past events from the target calendar if removeEventsFromCalendar is true)
var addEventsToCalendar = true;        // If you turn this to "false", you can check the log (View > Logs) to make sure your events are being read correctly before turning this on
var modifyExistingEvents = true;       // If you turn this to "false", any event in the feed that was modified after being added to the calendar will not update
var removeEventsFromCalendar = true;   // If you turn this to "true", any event created by the script that is not found in the feed will be removed.
var addAlerts = true;                  // Whether to add the ics/ical alerts as notifications on the Google Calendar events, this will override the standard reminders specified by the target calendar.
var addOrganizerToTitle = false;       // Whether to prefix the event name with the event organiser for further clarity
var descriptionAsTitles = false;       // Whether to use the ics/ical descriptions as titles (true) or to use the normal titles as titles (false)
var addCalToTitle = false;             // Whether to add the source calendar to title
var addAttendees = false;              // Whether to add the attendee list. If true, duplicate events will be automatically added to the attendees' calendar.
var defaultAllDayReminder = -1;        // Default reminder for all day events in minutes before the day of the event (-1 = no reminder, the value has to be between 0 and 40320)
                                       // See https://github.com/derekantrican/GAS-ICS-Sync/issues/75 for why this is neccessary.
var overrideVisibility = "";           // Changes the visibility of the event ("default", "public", "private", "confidential"). Anything else will revert to the class value of the ICAL event.
var addTasks = false;

var emailSummary = false;              // Will email you when an event is added/modified/removed to your calendar
var email = "";                        // OPTIONAL: If "emailSummary" is set to true or you want to receive update notifications, you will need to provide your email address

The timezone of the google script is set to GMt+1 CET - Berlin (just checked and redeployed just in case)


I am happy to give further details wherever possible, and give the ahk-/bash-source code I used for generating the file I am creating the calendar from.

I am aware that it is probably non-standard to have a multitude of different timezones within the same calendar, however when added "the normal way" they are handled fine - and thus I assume this is an issue with the google-script, and not my method of generating the iCal-file.


Thank you.
Sincerely,
~Gw

@Gewerd-Strauss Gewerd-Strauss added the bug Something isn't working label Nov 15, 2022
@jonas0b1011001 jonas0b1011001 removed the bug Something isn't working label Nov 16, 2022
@jonas0b1011001
Copy link
Collaborator

DTSTART;TZID=/America/New_York:20221117T190000
DTEND;TZID=/America/New_York:20221117T230000

should be

DTSTART;TZID=America/New_York:20221117T190000
DTEND;TZID=America/New_York:20221117T230000

In Helpers.gs after Line 283 add the following to get rid of the "/" at the beginning:

if (tzid[0] == "/"){
      tzid = tzid.substr(1)
    }

@derekantrican
Copy link
Owner

@Gewerd-Strauss - did you have a chance to try @jonas0b1011001 's suggestion?

@derekantrican
Copy link
Owner

Closing as there has been no response. Please comment again if this is still an issue

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

3 participants