janrg / MeeusSunMoon

JavaScript module to calculate times for sunrise, solar noon, and sunset, as well as moon phases based on "Astronomical Algorithms" by Jean Meeus
MIT License
31 stars 9 forks source link

General Feedback and Input Validation #46

Open saturdaywalkers opened 1 month ago

saturdaywalkers commented 1 month ago

There are quite a few nodejs astronomy packages. Chose this one because of your notes about accuracy.

Had a lot of frustration at the start, lat/lon's I was using were strings rather than numbers, but the error messages weren't obvious.

May I suggest validating if input is a number, and either silently converting it or an "lat/lon is not a number" error message

Also, an example of "js date" => "luxon date" => sunrise date => "js date" would help (as hadn't come across the luxon date package before)

Thanks for all the work!