udivankin / sunrise-sunset

Sunrise and sunset time calculation for given coordinates. ~1kb minified with zero dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sunset can occur before sunrise

texels opened this issue · comments

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.

commented

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!