warmsound / crystal-face

Garmin Connect IQ watch face
https://apps.garmin.com/en-GB/apps/9fd04d09-8c80-4c81-9257-17cfa0f0081b
GNU General Public License v3.0
381 stars 124 forks source link

Time Zone data is wrong for some cities that abandoned DST #185

Open WarpedPixel opened 3 years ago

WarpedPixel commented 3 years ago

The time zone request seems to be parsed correctly but the service is returning incorrect data (says there is DST but that is no longer true). The bug is in the service or the service request (I can't tell), not in the watch face code. Example: Request: https://script.google.com/macros/s/AKfycbwPas8x0JMVWRhLaraJSJUcTkdznRifXPDovVZh8mviaf8cTw/exec?city=Rio%20de%20Janeiro Response: {"requestCity":"Rio de Janeiro","city":"Rio de Janeiro","current":{"gmtOffset":-7200,"dst":true},"next":{"when":1613872800,"gmtOffset":-10800,"dst":false}} Which is correctly parsed as GMT-2, but the correct time is GMT-3, and there are no upcoming DST time changes. See here: https://www.timeanddate.com/time/change/brazil/rio-de-janeiro

WarpedPixel commented 3 years ago

Of course, current time is less than "when" in the query result in my previous comment.

I implemented a workaround: any city that ends in "*" will use the timezone for the city ignoring any DST information (will always pick the gmtOffset where DST is false, if any).

warmsound commented 3 years ago

@WarpedPixel thanks for reporting this. The service is based on a Google Sheet containing data from TimeZoneDB. I implemented this service, rather than using the TimeZoneDB API directly, either because I wanted more control over the data returned from the API call, or to avoid breaking their terms of service (I forget which). I didn't realise at the time, that time zone data can change surprisingly frequently: a colleague of mine works in Volgograd, where the time zone has changed twice since I implemented the service back in October 2018.

I'll assign myself this issue, and will try and get round to updating the Google Sheet shortly, and also check if there is a way, either directly from the watch, or indirectly via the existing service, to query the live TimeZoneDB API. Thanks!

2b2bff commented 3 years ago

There is a good video on YouTube about developers and time zones and why you should rely on APIs instead of doing it yourself... ;) https://www.youtube.com/watch?v=-5wpm-gesOY