As of SDK3, Athom has changed Homey to always work in UTC timezone…
I am trying to move my app IcalCalendar from SDK2 to SDK3, but this change in timezone behavior has made it quite problematic.
In SDK2 the calendars were read and start / end were correctly converted to date objects with correct timezone offset.
In SDK3 the calendars are read but start / end are converted to date objects with UTC, and are missing timezone offsets.
I can use moment with the timezone found in Homey (this.homey.clock.getTimezone()) to get the offsets back, however i don’t seem to have found the correct way to add the offsets to the date to get correct start / end.
If that’s not what you need, what exactly is it you do need? The code you’re linking to contains too much context to understand the underlying issue you’re having
By the way, you can run the above code locally with Node.js, which saves some time with the whole make-a-minor-change-and-upload-your-entire-app cycle for Homey. To set the timezone to UTC, just like with SDKv3, you can use the TZ environment variable (at least on Linux and macOS):
I was already using moment-timezone to convert the date to local, but hadn’t found the correct way to add the offset. With your suggestion to set my local TZ to UTC it helped quite a lot and sped up the process, so thank you!