Convert "dtStart"/"dtEnd" timezones of schedule to local timezone/timezone

Hello,

I am retrieving the stream schedule of various channels via the API, using the helix/schedule/icalendar-endpoint. Each event then contains the dtStart and dtEnd-parameters, containing the start and end time.

However, against what I was expecting (and what various sources only assume as well), the timestamps retrieved by the API are not in UTC. E.g this is the return I receive for Critical Role:

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

Below is the (correctly) formatted time as displayed on the stream’s schedule when visiting the website. My timezone is UTC+1/UTC+2 (winter/summer).


For a channel in my own timezone, the values obviously match up, not that it’s relevant really.

The issue I am having is that I simply do not know how to convert from Arbitrary TimezoneX to Arbitrary TimezoneY, or to the local timezone (without hardcoding it in, I mean, which while possible is not really a solution to this issue.)

And thus, I am kinda stuck.

Is this known behaviour, or should I have received UTC-formatted timestamps? Does anyone have any tips?

Thank you.
Sincerely,
~Gw

Use a time parsing library for your programming language of choice.
Or since you are pulling the iCal feed, pass it into an iCal parsing library for your programming langauge of choice

Which is what any calendar system does (like google calendar) when you feed it the iCal URL.

so

DSTAMP is the time this iCal was generated. The Z specifies Zulu aka UTC

Start/endd
Decalres the Timezone, New York, and it’s 2022 11 17 Time 19:00:00 thru 23:00:00 (New York Time)

This is according to the iCal speficiation. So no, not a unix timestamp.

pass it into an iCal parsing library for your programming langauge of choice

Which is what any calendar system does (like google calendar) when you feed it the iCal URL.

Which evidently does not appear to be the case for google cal - it converts these timestamps neither to UTC, nor to the timezone set in its own settings. Not sure why - as there’s no reason for it not to, and plenty for it to do so, but that is evidently the case here, as shown above. ¯\_(ツ)_/¯

I suppose I will search for a suitable lib then.

Thank you.

Google seems to be showing various calendars correctly with the right timezone offsets for when when added feeds to my Gcal.

So not sure what you mean here.

I believe the iCal specification (from a quick scan) can’t do “normal” unix timestamps.

iCal runs off these formatted strings (TimeZone/LongForm date), which according to the spec is based on ISO 8601

See page 35 - https://www.ietf.org/rfc/rfc2445.txt