updated to "pray-calc" and synodic accuracy

This commit is contained in:
Ali Camarata 2023-11-14 12:25:53 +07:00
parent d7c449ece7
commit 0cb2267da6
5 changed files with 15 additions and 15 deletions

View file

@ -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).
## Installation
```bash
npm install praycalc
npm install pray-calc
```
## Usage
Example of using praycalc to get prayer times:
Example of using pray-calc to get prayer times:
```js
const { getTimes, calcTimesAll } = require('praycalc');
const { getTimes, calcTimesAll } = require('pray-calc');
const date = new Date();

View file

@ -4,9 +4,9 @@
* @returns {number} The moon phase as a fraction from 0 (new moon) to just under 1 (end of lunar cycle).
*/
function getMoonPhase(date) {
const synodicMonth = 29.530588861; // Average length of a synodic month in days
// Most recent known new moon: November 13, 2023, 03:27 AM
const knownNewMoon = new Date(Date.UTC(2023, 10, 13, 3, 27, 0));
const synodicMonth = 29.53058821398858; // Average length of a synodic month in days
// Most recent known new moon: November 13, 2023, 09:27 AM UTC
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
const diffInMilliseconds = date - knownNewMoon;

2
index.d.ts vendored
View file

@ -1,5 +1,5 @@
// 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 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;

8
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "praycalc",
"version": "1.3.2",
"name": "pray-calc",
"version": "1.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "praycalc",
"version": "1.3.2",
"name": "pray-calc",
"version": "1.4.0",
"license": "ISC",
"dependencies": {
"nrel-spa": "^1.2.2",

View file

@ -1,6 +1,6 @@
{
"name": "praycalc",
"version": "1.3.2",
"name": "pray-calc",
"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)",
"main": "index.js",
"scripts": {
@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/ussunnah/praycalc"
"url": "https://github.com/ussunnah/pray-calc"
},
"author": "USF",
"license": "ISC",