mirror of
https://github.com/acamarata/pray-calc.git
synced 2026-06-30 19:04:26 +00:00
added getMoon
This commit is contained in:
parent
cf8aa20577
commit
0f6b4046f3
3 changed files with 10 additions and 2 deletions
|
|
@ -27,9 +27,11 @@ console.log(prayerTimes);
|
|||
|
||||
Exported functions include getTimes, calcTimes, getTimesAll, calcTimesAll where the "get" functions return fractal or decimal times directly from the source nrel-spa calculator and the "calc" functions return formatted times in HH:MM:SS.sss format. The functions will give results including our custom angle but the "All" functions will include a methods key with all traditional static angle methods (Muslim World League, Egyptian General Authority of Survey, ISNA, etc.) included as well for their Fajr and Isha times.
|
||||
|
||||
Additionally we included the function "getMoon" which takes only the date object and an optional "accuracy=false" if you wish to avoid the Earth to Sun Distance calculation. The result back will give you fraction:, phase, and angle. This can assist in calculating the moon's illumination at specific times such as after Maghrib in a location's timezone to know the possibility of seeing the moon.
|
||||
|
||||
### Parameters:
|
||||
|
||||
- date: The date for which prayer times are calculated.
|
||||
- date: Javascript Date object for the date to calculate prayer times for.
|
||||
- lat: Latitude of the location.
|
||||
- lng: Longitude of the location.
|
||||
- elevation: Elevation in meters (optional, default 50).
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const { getEarthSunDistance } = require('./getEarthSunDistance');
|
||||
|
||||
function getMoon(date, accurate = false) {
|
||||
function getMoon(date, accurate = true) {
|
||||
const PI = Math.PI;
|
||||
const rad = PI / 180;
|
||||
const e = rad * 23.4397; // obliquity of the Earth
|
||||
|
|
@ -59,3 +59,7 @@ function getMoon(date, accurate = false) {
|
|||
angle: angle
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getMoon
|
||||
};
|
||||
|
|
|
|||
2
index.js
2
index.js
|
|
@ -1,3 +1,4 @@
|
|||
const { getMoon } = require('./getMoon');
|
||||
const { getTimes } = require('./getTimes');
|
||||
const { calcTimes } = require('./calcTimes');
|
||||
const { getTimesAll } = require('./getTimesAll');
|
||||
|
|
@ -5,6 +6,7 @@ const { calcTimesAll } = require('./calcTimesAll');
|
|||
|
||||
|
||||
module.exports = {
|
||||
getMoon,
|
||||
getTimes,
|
||||
calcTimes,
|
||||
getTimesAll,
|
||||
|
|
|
|||
Loading…
Reference in a new issue