udivankin / sunrise-sunset

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

Sunset can occur before sunrise #6

Closed texels closed 4 years ago

texels commented 4 years ago

While technically correct, I dont think this is intuitive. const d = new Date( 'may-26-2019' ) console.log( Solar.getSunrise( 38.88333, -77.03333, d ) ) console.log( Solar.getSunset( 38.88333, -77.03333, d ) )

prints 2019-05-26T09:48:18.374Z 2019-05-26T00:22:08.624Z

Note the sunset occurs before the sunrise

After the sunrise at 9:48, the next sunset (which is the one I was expecting) actually falls on may 27th at 00:23.

udivankin commented 4 years ago

Hey texels!

This is indeed technically correct and also out of scope of this library, but I managed to add one usage example to README.MD which I believe could help you, check it out!