tauqeet-js 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026
3
+ Copyright (c) 2026 Ghulam Hasnain
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,88 +1,143 @@
1
- # 🌌 Tauqeet.js
2
-
3
- **Tauqeet.js** is a high-precision, low-code JavaScript library for Islamic prayer times and astronomical ephemeris. Built on the gold-standard algorithms of **Jean Meeus**, it provides sub-second accuracy for global prayer times, solar/lunar positioning, and Qibla direction.
4
-
5
- [![NPM Version](https://img.shields.io/npm/v/tauqeet-js)](https://www.npmjs.com/package/tauqeet-js)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- ## Why Tauqeet.js?
9
- In Urdu and Arabic, *Tauqeet* refers to the science of timekeeping, specifically for religious purposes. This library is designed to bring that ancient precision to the modern web with a focus on:
10
- - **Sub-Second Precision:** Uses Successive Approximation loops for perfect convergence.
11
- - **Topocentric Accuracy:** Accounts for refraction (**Bennett Formula**), solar semidiameter, parallax, and **Altitude (Elevation)**.
12
- - **Scientific Asr:** Refined shadow-counting logic using apparent visual horizons.
13
- - **Low-Code API:** Get results in one line of code.
14
- - **Robust:** Hardened against division-by-zero errors at poles and extreme latitudes.
15
-
16
- ## 🚀 Quick Start (One-Liner)
17
-
18
- ```javascript
19
- import { calculate } from 'tauqeet-js';
20
-
21
- // Get times for London (51.5, -0.1) using the Karachi method
22
- const times = calculate(51.5074, -0.1278);
23
-
24
- console.log(times.fajr);
25
- ```
26
-
27
- ## 🛠️ Advanced Features
28
-
29
- ### 1. Elevation / Altitude Support
30
- Tauqeet.js handles the "Dip of the Horizon" based on your vertical height.
31
- ```javascript
32
- const times = calculate(31.4, 73.0, 'Karachi', 'Hanafi', new Date(), 1000); // 1000 meters elevation
33
- ```
34
-
35
- ### 2. High-Level Config
36
- ```javascript
37
- import { getPrayerTimes } from 'tauqeet-js';
38
-
39
- const schedule = getPrayerTimes({
40
- location: { latitude: 31.4, longitude: 73.0, elevation: 500 },
41
- method: 'MWL',
42
- madhab: 'Hanafi',
43
- date: new Date()
44
- });
45
- ```
46
-
47
- ### 2. Scientific Asr Accuracy
48
- New in v1.0.1: Accounts for **Solar Semi-Diameter** and **Atmospheric Refraction** at both Noon (Dhuhr) and Asr for bit-perfect alignment with visual shadow observations.
49
-
50
- ### 3. Atmospheric Refraction (Bennett Formula)
51
- Specify your local weather conditions to refine refraction using the high-precision **Bennett's Formula (1982)**.
52
- ```javascript
53
- const times = getPrayerTimes({
54
- location: { latitude: 31.4, longitude: 73.0 },
55
- temperature: 25, // 25°C
56
- pressure: 1013, // 1013 mbar
57
- pressureUnit: 'mbar' // 'kPa' or 'mbar'
58
- });
59
- ```
60
-
61
- ### 4. High-Precision Astronomy
62
- Access coordinates for the Sun, Moon (including phases), and Polaris.
63
- ```javascript
64
- import { Astronomy } from 'tauqeet-js';
65
-
66
- const astro = new Astronomy();
67
- console.log(astro.moon.illumination); // Current moon phase %
68
- console.log(astro.sun.GHA); // Sun Greenwich Hour Angle
69
- ```
70
-
71
- ### 5. Qibla & Sun Alignment
72
- Calculates the Great Circle bearing, distance, and even **Sun Alignment** times (when the sun points exactly towards Qibla).
73
- ```javascript
74
- import { calculateQibla, calculateSunAtQibla } from 'tauqeet-js';
75
-
76
- const qibla = calculateQibla({ latitude: 31.4, longitude: 73.0 });
77
- const sunTimes = calculateSunAtQibla(31.4, 73.0);
78
- // sunTimes.qibla -> Time the sun is at the Qibla bearing
79
- ```
80
-
81
- ## 📐 Accuracy Benchmark
82
- This library aligns with:
83
- - **Astro-Almanac HP** (Henning Umland)
84
- - **Jean Meeus** (Astronomical Algorithms)
85
- - **Islamic Standard Methods** (Karachi, MWL, ISNA, Egypt, Tehran, Jafari, Makkah)
86
-
87
- ## 📄 License
88
- MIT © 2026 Ghulam Hasnain.
1
+ # tauqeet-js
2
+
3
+ **A high-precision TypeScript library for Islamic astronomical calculations.**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5%2B-blue)](https://www.typescriptlang.org/)
7
+
8
+ > 📖 **Interactive documentation & live API explorer:** [https://tauqeet-js.web.app](https://tauqeet-js.web.app)
9
+
10
+ `tauqeet-js` (تَوقِيت — Arabic for "timing") provides high-fidelity Islamic astronomical computation powered by a full VSOP87-derived solar ephemeris, lunar theory, and ΔT correction. It is modular by design — import only the feature you need.
11
+
12
+ ---
13
+
14
+ ## Table of Contents
15
+
16
+ - [Features](#features)
17
+ - [Prerequisites](#prerequisites)
18
+ - [Installation](#installation)
19
+ - [Quick Start](#quick-start)
20
+ - [Documentation](#documentation)
21
+ - [Modules Overview](#modules-overview)
22
+ - [License](#license)
23
+ - [Author](#author)
24
+
25
+ ---
26
+
27
+ ## Features
28
+
29
+ | Module | Capability |
30
+ |---|---|
31
+ | **Prayers** | Fajr, Sunrise, Ḍuḥā, Dhuhr, Asr, Maghrib, Isha with 8 built-in calculation methods |
32
+ | **Qibla** | Great-circle bearing, rhumb-line bearing, and distance to the Kaaba |
33
+ | **Moon** | Phase, illumination, age, lunar events, crescent visibility (Odeh / Yallop / HMNAO) |
34
+ | **Hijri** | Gregorian ↔ Hijri conversion via Civil, Conjunction, Visibility, or Umm al-Qura methods |
35
+ | **Solar Alignment** | Times when the sun aligns with the Qibla direction (useful for compass calibration) |
36
+
37
+ ---
38
+
39
+ ## Prerequisites
40
+
41
+ - **Node.js** ≥ 18
42
+ - **TypeScript** ≥ 5 (for source usage)
43
+ - ESM-first; CJS bundle also provided.
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ npm install tauqeet-js
51
+ ```
52
+
53
+ > **Note:** The package is currently in active development. See [CONTRIBUTING.md](CONTRIBUTING.md) for building from source.
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ ### Prayer Times
60
+
61
+ ```ts
62
+ import { calculatePrayerTimes, BUILT_IN_METHODS } from 'tauqeet-js';
63
+
64
+ // London, UK today
65
+ const result = calculatePrayerTimes({
66
+ lat: 51.5074,
67
+ long: -0.1278,
68
+ timeZone: 'Europe/London',
69
+ method: 'MWL', // Muslim World League
70
+ madhab: 'Shafi',
71
+ });
72
+
73
+ console.log(result.fajr.local); // e.g. "03:41 AM"
74
+ console.log(result.dhuhr.local); // e.g. "01:05 PM"
75
+ console.log(result.isha.local); // e.g. "10:52 PM"
76
+ ```
77
+
78
+ ### Qibla Direction
79
+
80
+ ```ts
81
+ import { getQiblaDirection } from 'tauqeet-js';
82
+
83
+ const qibla = getQiblaDirection({ latitude: 51.5074, longitude: -0.1278 });
84
+ console.log(`Bearing to Kaaba: ${qibla.bearing?.toFixed(2)}°`);
85
+ console.log(`Distance: ${qibla.distanceKm.toFixed(0)} km`);
86
+ ```
87
+
88
+ ### Moon Phase
89
+
90
+ ```ts
91
+ import { getMoonPhase, getMoonAge } from 'tauqeet-js';
92
+
93
+ const phase = getMoonPhase(new Date());
94
+ console.log(`Phase: ${phase.phaseName}`); // e.g. "Waxing Crescent"
95
+ console.log(`Illumination: ${(phase.illuminatedFraction * 100).toFixed(1)}%`);
96
+
97
+ const age = getMoonAge(new Date());
98
+ console.log(`Moon age: ${age.ageDays.toFixed(1)} days`);
99
+ ```
100
+
101
+ ### Hijri Date Conversion
102
+
103
+ ```ts
104
+ import { toHijri, HijriMethod, HIJRI_MONTH_NAMES } from 'tauqeet-js';
105
+
106
+ const hijri = toHijri(new Date(), HijriMethod.CIVIL);
107
+ console.log(`${hijri.day} ${HIJRI_MONTH_NAMES[hijri.month - 1]} ${hijri.year} AH`);
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Documentation
113
+
114
+ | File | Description |
115
+ |---|---|
116
+ | [API.md](API.md) | Complete API reference for all exported functions, types, and classes |
117
+ | [USAGE.md](USAGE.md) | Practical code guides with real-world examples |
118
+ | [MODULES.md](MODULES.md) | Architecture overview and module import guide |
119
+ | [CONTRIBUTING.md](CONTRIBUTING.md) | Build, test, and contribution guidelines |
120
+
121
+ For the most up-to-date, interactive reference visit **[https://tauqeet-js.web.app](https://tauqeet-js.web.app)**.
122
+
123
+ ---
124
+
125
+ ## Modules Overview
126
+
127
+ ```
128
+ tauqeet-js
129
+ ├── prayers/ Prayer time engine (8 methods, high-latitude strategies)
130
+ ├── qibla/ Qibla bearing & distance to Mecca
131
+ ├── moon/ Moon phase, age, events, crescent visibility
132
+ ├── hijri/ Gregorian ↔ Hijri calendar conversion
133
+ ├── solar-alignment/ Sun-at-Qibla times
134
+ └── astronomy/ Internal ephemeris (VSOP87, lunar theory, ΔT) — private
135
+ ```
136
+
137
+ See [MODULES.md](MODULES.md) for a detailed dependency graph and tree-shaking guide.
138
+
139
+ ---
140
+
141
+ ## License
142
+
143
+ [MIT](LICENSE) © Ghulam Hasnain