udivankin / sunrise-sunset

Sunrise and sunset time calculation for given coordinates. ~1kb minified with zero dependencies.
74 stars 17 forks source link

Calculated sunrise is too early - Time Zone Problem? #4

Closed MiWeiss closed 5 years ago

MiWeiss commented 5 years ago

Possible duplicate of #2, but to be sure, I created a new issue. Also, this one might be a bit easier to reproduce.

Setup: We're checking the sunrise for Zermatt, Switzerland. Coordinates and Sunrise according to Google: (Source of both images: Google.com)

Bug: image The calculated time (04:47 CEST) is 2 hours off.

the same can be reproduced using the following command getSunrise(46.0207, 7.7491, new Date('Sat Apr 13 2019 21:51:00 GMT+0200 (Central European Summer Time)'));

I suspect that the difference is caused by the time zone offset between CEST and UTC.

udivankin commented 5 years ago

Thanks for this request, I appreciate it! Closing as fixed.