pminkov / commute-times

Commute Time Calculator
http://pminkov.github.io/commute/
10 stars 6 forks source link

Timezone difference #2

Open sebastianwr opened 7 years ago

sebastianwr commented 7 years ago

Hi! I think it's better suited here as on HN.

Something about the timezone consideration seems to be off. I run a query from my hometown to my work place and both locations as well as me right now are in the same timezone.

But the console log shows:

[Log]   Query timezone offset:  – 1 (commute-time.js, line 185)
[Log]   Local timezone offset:  – -2 (commute-time.js, line 186)
[Log]   Hour adjust - subtracting -1 hours. (commute-time.js, line 187)
[Log]   Monday, 6am (target) is the same as following local time: (commute-time.js, line 188)
[Log]   Mon Mar 27 2017 07:00:00 GMT+0200 (CEST) (commute-time.js, line 189)

If I can be of any help, let me know!

pminkov commented 7 years ago

The time zone for Essen is GMT+1. So Google's TZ API seems to get that right.

However, the timezone coming from your browser looks wrong (GMT+2).

What do you see when you type this in your browser:

new Date(); Mon Mar 20 2017 13:04:53 GMT-0700 (PDT)

Does the time zone match your real time zone?

sebastianwr commented 7 years ago

Safari output was looking correct (GMT+1, CET). But I just looked at the code of the debug output and saw that you take the next Monday.

On Saturday we will change to summer time (GMT+2, CEST). That was tricky ;)