mirror of
https://github.com/acamarata/pray-calc.git
synced 2026-07-02 03:40:39 +00:00
updated to "pray-calc" and synodic accuracy
This commit is contained in:
parent
d7c449ece7
commit
0cb2267da6
5 changed files with 15 additions and 15 deletions
|
|
@ -1,20 +1,20 @@
|
||||||
|
|
||||||
# praycalc
|
# pray-calc
|
||||||
|
|
||||||
Prayer times calculator using nrel-spa and custom formula for Fajr and Isha angles (as well as traditional static angle methods in the All function).
|
Prayer times calculator using nrel-spa and custom formula for Fajr and Isha angles (as well as traditional static angle methods in the All function).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install praycalc
|
npm install pray-calc
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Example of using praycalc to get prayer times:
|
Example of using pray-calc to get prayer times:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { getTimes, calcTimesAll } = require('praycalc');
|
const { getTimes, calcTimesAll } = require('pray-calc');
|
||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
* @returns {number} The moon phase as a fraction from 0 (new moon) to just under 1 (end of lunar cycle).
|
* @returns {number} The moon phase as a fraction from 0 (new moon) to just under 1 (end of lunar cycle).
|
||||||
*/
|
*/
|
||||||
function getMoonPhase(date) {
|
function getMoonPhase(date) {
|
||||||
const synodicMonth = 29.530588861; // Average length of a synodic month in days
|
const synodicMonth = 29.53058821398858; // Average length of a synodic month in days
|
||||||
// Most recent known new moon: November 13, 2023, 03:27 AM
|
// Most recent known new moon: November 13, 2023, 09:27 AM UTC
|
||||||
const knownNewMoon = new Date(Date.UTC(2023, 10, 13, 3, 27, 0));
|
const knownNewMoon = new Date(Date.UTC(2023, 10, 13, 9, 27, 0));
|
||||||
|
|
||||||
// Convert both dates to the number of milliseconds since Unix Epoch and find the difference
|
// Convert both dates to the number of milliseconds since Unix Epoch and find the difference
|
||||||
const diffInMilliseconds = date - knownNewMoon;
|
const diffInMilliseconds = date - knownNewMoon;
|
||||||
|
|
|
||||||
2
index.d.ts
vendored
2
index.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
// index.d.ts
|
// index.d.ts
|
||||||
declare module 'praycalc' {
|
declare module 'pray-calc' {
|
||||||
export function getMoon(date: Date, latitude?: number, longitude?: number, elevation?: number, temp?: number, pressure?: number, humidity?: number, clouds?: number): MoonDetails;
|
export function getMoon(date: Date, latitude?: number, longitude?: number, elevation?: number, temp?: number, pressure?: number, humidity?: number, clouds?: number): MoonDetails;
|
||||||
export function getTimes(date: Date, lat: number, lng: number, tz: number, elevation?: number, temperature?: number, pressure?: number): TimesReturnType;
|
export function getTimes(date: Date, lat: number, lng: number, tz: number, elevation?: number, temperature?: number, pressure?: number): TimesReturnType;
|
||||||
export function calcTimes(date: Date, lat: number, lng: number, tz: number, elevation?: number, temperature?: number, pressure?: number): CalcTimesReturnType;
|
export function calcTimes(date: Date, lat: number, lng: number, tz: number, elevation?: number, temperature?: number, pressure?: number): CalcTimesReturnType;
|
||||||
|
|
|
||||||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "praycalc",
|
"name": "pray-calc",
|
||||||
"version": "1.3.2",
|
"version": "1.4.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "praycalc",
|
"name": "pray-calc",
|
||||||
"version": "1.3.2",
|
"version": "1.4.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nrel-spa": "^1.2.2",
|
"nrel-spa": "^1.2.2",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "praycalc",
|
"name": "pray-calc",
|
||||||
"version": "1.3.2",
|
"version": "1.4.0",
|
||||||
"description": "Prayer times calculator using nrel-spa and custom formula for Fajr and Isha angles (as well as traditional static angle methods in the All function)",
|
"description": "Prayer times calculator using nrel-spa and custom formula for Fajr and Isha angles (as well as traditional static angle methods in the All function)",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/ussunnah/praycalc"
|
"url": "https://github.com/ussunnah/pray-calc"
|
||||||
},
|
},
|
||||||
"author": "USF",
|
"author": "USF",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue