savdagod / ha-addons

HA add-on repository
MIT License
4 stars 2 forks source link

v1.0.9 unknown timezone error #8

Closed savdagod closed 1 week ago

savdagod commented 1 week ago

@IngmarStein hoping you might have some insight on this issue. Might be something as simple as a missing library. There are apps I use such as the Halloween countdown app that uses time zones. When trying to render, it seems it cannot find the time zones used (ie “America/New_York”). I tried to add tzdata to the dependencies in the Dockerfile but that didn’t seem to fix the issue.

savdagod commented 1 week ago

Looks like I figured it out, I added _ “time/tzdata” to the main.go imports and now it seems to work.

IngmarStein commented 1 week ago

Ha, you found it before I even saw the notification :) The import is the right solution. An alternative would have been building with -tags timetzdata (https://pkg.go.dev/time/tzdata). Adding tzdata to the Dockerfile didn't work because the final image is built FROM scratch, so it would have been necessary to copy that data from the build to the final image (see https://medium.com/@mhcbinder/using-local-time-in-a-golang-docker-container-built-from-scratch-2900af02fbaf).