batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript
MIT License
368 stars 81 forks source link

Altitude Support #126

Closed Zalanshah64 closed 1 year ago

Zalanshah64 commented 1 year ago

Some scholars (one of whom specifically told me this) are very strict and explicitly want to see the sun go down. When on a plane or at very high altitudes, this would result in the sun setting later.

Does this library feature support for altitudes in its calculations? If so, how? If not, are there any plans to add support for this?

Most phones have altimeters today, which would directly aid in this calculation.

z3bi commented 1 year ago

Altitude is tricky as it only has an effect when the altitude of the observer differs from the altitude of the horizon, for example being on mountain peak. But if the city you live in has a high altitude in all locations it has no effect.

Here is a good explanation of the apparent effects of altitude on sunrise https://astronomy.stackexchange.com/questions/24632/how-do-i-adjust-the-sunrise-equation-to-account-for-elevation

So in addition to knowing the user's altitude, we would need to know the altitude of the horizon which is much harder to know. For this reason altitude is not something that has been added to this library.