Bug in the new large clock app

@joeyhoer I live in Hawaii and the daytime / night color doesn’t seem to be working. It’s 1:48PM here now and it is displaying the clock in the night time color. Maybe there is a timezone issue with the cache ?

The timezone calculations are a bit strange because the API I’m using returns times in UTC.

I believe the issue is because, in UTC, the sunrise time in Hawaii occurs today while the sunset time occurs tomorrow. I think this is throwing off the day/night evaluation.

I believe a fix is to just add 24 hours to the sunset time if the sunset time occurs before the sunrise time. This might not be the most elegant fix, but it seems to work. A better solution might be to convert the dates properly.

Can you test the version I pushed here, and let me know if it fixes your issue? https://github.com/joeyhoer/tidbyt-apps/blob/master/big_clock.star

You’ll need to update the default location and timezone with the correct values for your location, and then use pixlet serve or pixlet render to test.

@joeyhoer you should join the Discord if you haven’t already! Was showing off the big clock but couldn’t @ you :sob: Tidbyt Discord - #6 by mark

according to @betterengineering on the discord, the cache is app wide and so using such a generic cache key as “data” will make everyone running the app share this the same value ? Is this not correct ?
# Fetch sunrise/sunset times
data = cache.get("data")

Thus everyone will share the same sunset/sunrise time ?

I will test your new version in the morning and report back.

your new version does work correctly when run locally now.