You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With some longitude and latitude, the SunCalc dates (dawn, dusk, nauticalDawn, night, …) are created with a NaN time. This can lead to unexpected behavior when using this library. This issue can be reproduced if the latitude/longitude is set for example to 89.0/179.0 or 84.0/111.0.
The root problem is caused by the use of acos() with invalid input:
Note that the original Javascript library also has the same issue, as well as most of the implementations based on this original library. See for example the related issues:
One solution would be to implement the fix suggested in the Flutter library: shanus/flutter_suncalc#1
I implemented this workaround in a Swift package port of this code and you can find the commit here: Timac/SunCalc@cad82c3
I am not sure if this code is still under development. Applying this workaround would break the compatibility with old software using this source code.
The text was updated successfully, but these errors were encountered:
Description
With some longitude and latitude, the SunCalc dates (dawn, dusk, nauticalDawn, night, …) are created with a NaN time. This can lead to unexpected behavior when using this library. This issue can be reproduced if the latitude/longitude is set for example to 89.0/179.0 or 84.0/111.0.
The root problem is caused by the use of
acos()
with invalid input:Note that the original Javascript library also has the same issue, as well as most of the implementations based on this original library. See for example the related issues:
Workaround
One solution would be to implement the fix suggested in the Flutter library: shanus/flutter_suncalc#1
I implemented this workaround in a Swift package port of this code and you can find the commit here: Timac/SunCalc@cad82c3
I am not sure if this code is still under development. Applying this workaround would break the compatibility with old software using this source code.
The text was updated successfully, but these errors were encountered: