tauqeet-js 1.1.2 → 1.1.4
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/CHANGELOG.md +31 -61
- package/LICENSE +21 -21
- package/README.md +50 -87
- package/dist/astronomy/index.cjs +8495 -0
- package/dist/astronomy/index.cjs.map +1 -0
- package/dist/astronomy/index.d.cts +238 -0
- package/dist/astronomy/index.d.ts +238 -0
- package/dist/astronomy/index.js +8474 -0
- package/dist/astronomy/index.js.map +1 -0
- package/dist/hijri/index.cjs +9474 -1879
- package/dist/hijri/index.cjs.map +1 -1
- package/dist/hijri/index.d.cts +4 -8
- package/dist/hijri/index.d.ts +4 -8
- package/dist/hijri/index.js +9474 -1879
- package/dist/hijri/index.js.map +1 -1
- package/dist/index.cjs +10064 -1940
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10045 -1941
- package/dist/index.js.map +1 -1
- package/dist/moon/index.cjs +7542 -1880
- package/dist/moon/index.cjs.map +1 -1
- package/dist/moon/index.d.cts +1 -1
- package/dist/moon/index.d.ts +1 -1
- package/dist/moon/index.js +7542 -1880
- package/dist/moon/index.js.map +1 -1
- package/dist/prayers/index.cjs +7539 -1157
- package/dist/prayers/index.cjs.map +1 -1
- package/dist/prayers/index.d.cts +1 -6
- package/dist/prayers/index.d.ts +1 -6
- package/dist/prayers/index.js +7539 -1157
- package/dist/prayers/index.js.map +1 -1
- package/dist/solar-alignment/index.cjs +7379 -1097
- package/dist/solar-alignment/index.cjs.map +1 -1
- package/dist/solar-alignment/index.js +7379 -1097
- package/dist/solar-alignment/index.js.map +1 -1
- package/package.json +137 -116
package/CHANGELOG.md
CHANGED
|
@@ -1,83 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to
|
|
3
|
+
All notable changes to tauqeet-js are documented here.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Unreleased
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## [Unreleased]
|
|
7
|
+
## 1.1.3 — 2026-07-09
|
|
10
8
|
|
|
11
9
|
### Added
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
10
|
+
- Per-module subpath exports for `prayers`, `qibla`, `moon`, `hijri`, and `solar-alignment`.
|
|
11
|
+
- Optional fallback diagnostics in timezone and formatting helpers.
|
|
12
|
+
- More explicit validation for custom prayer angles and high-latitude configuration.
|
|
13
|
+
- New documentation set covering API usage, configuration, errors, performance, and migration guidance.
|
|
16
14
|
|
|
17
15
|
### Changed
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
16
|
+
- Prayer-time calculation now reuses transit data more effectively in the hot path.
|
|
17
|
+
- Solar-alignment evaluation now reuses cached solar positions for repeated lookups.
|
|
18
|
+
- The astronomy kernel uses a single-pass Kahan-style loop for nutation accumulation with lower allocation pressure.
|
|
19
|
+
- The public surface is now documented as module-focused and tree-shakeable.
|
|
21
20
|
|
|
22
21
|
### Fixed
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- Duplicate Dhuhr work in the prayer engine was removed.
|
|
23
|
+
- Formatting and timezone fallback paths now surface diagnostics instead of silently degrading.
|
|
24
|
+
- Unexpected errors in moon-visibility logic are no longer swallowed indiscriminately.
|
|
25
|
+
|
|
26
|
+
### Performance
|
|
27
|
+
- VSOP87 evaluation paths use parallel `Float64Array` tables and unrolled Kahan accumulation.
|
|
28
|
+
- Benchmarks from the audit show approximately 15,800 ops/sec, 0.0633 ms average latency, and 33.9 KB gzip bundle size for the optimized path.
|
|
29
|
+
|
|
30
|
+
### Migration Notes
|
|
31
|
+
- No public APIs were removed in 1.1.3.
|
|
32
|
+
- Existing code using `calculatePrayerTimes()` and `getPrayerTimes()` continues to work.
|
|
33
|
+
- If you want smaller bundles, prefer module subpath imports such as `tauqeet-js/prayers` and `tauqeet-js/moon`.
|
|
34
|
+
- If you previously relied on silent fallback behaviour, update your code to handle `Result` failures or catch `PrayerCalculationError` explicitly.
|
|
25
35
|
|
|
26
36
|
---
|
|
27
37
|
|
|
28
|
-
##
|
|
38
|
+
## 1.1.0 — 2026-06-14
|
|
29
39
|
|
|
30
40
|
### Added
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
- `HIJRI_MONTH_NAMES` constant array.
|
|
35
|
-
- **Solar Alignment module** (`src/solar-alignment/`): computes times when the sun aligns with the Qibla direction, useful for compass calibration.
|
|
36
|
-
- `EphemerisService` singleton with LRU cache (10-day window) and Lagrange 3-point interpolation for solar ephemeris, reducing per-prayer computation cost.
|
|
37
|
-
- `withMetadata` option on `calculatePrayerTimes` / `getPrayerTimes` to expose DEC, EOT, HP, SD, and solver iteration counts per prayer.
|
|
38
|
-
- `dhahwaKubra` (Ḍuḥā Kubrā) time to prayer results — the midpoint between Fajr and Sunset.
|
|
39
|
-
- Atmospheric corrections (`temperatureC`, `pressureMbar`) for refraction-accurate Sunrise/Maghrib.
|
|
40
|
-
- `resolveTimezoneAsync` hook on `PrayerConfig` for async timezone resolution.
|
|
41
|
-
- `highLatitudeStrategy` option: `'AngleBased'`, `'MiddleOfNight'`, `'SeventhOfNight'`, `'NearestLatitude'`.
|
|
41
|
+
- Hijri conversion via Civil, Conjunction, Visibility, and Umm al-Qura methods.
|
|
42
|
+
- Solar alignment calculations via `getSunAtQibla()`.
|
|
43
|
+
- Additional prayer metadata and high-latitude strategies.
|
|
42
44
|
|
|
43
45
|
### Changed
|
|
44
|
-
-
|
|
45
|
-
- Iterative refinement for Solar Declination and Equation of Time inside the solar alignment solver.
|
|
46
|
-
- Validator (`validatePrayerConfig`) now supports DMS string and object coordinate formats.
|
|
47
|
-
- `timeZone` falls back to `Intl.DateTimeFormat().resolvedOptions().timeZone` when omitted.
|
|
48
|
-
- Default madhab changed to `Hanafi`; default method per madhab derived from `isDefault` flag in registry.
|
|
49
|
-
|
|
50
|
-
### Fixed
|
|
51
|
-
- Sub-second inaccuracies in astronomical event times resolved by iterative ephemeris refinement.
|
|
52
|
-
- Pressure validation now enforces integer check (`Number.isInteger`).
|
|
53
|
-
- Timezone offset widening (`string | number`) corrected throughout all modules.
|
|
46
|
+
- The library now supports async timezone resolution and richer prayer configuration.
|
|
54
47
|
|
|
55
48
|
---
|
|
56
49
|
|
|
57
|
-
##
|
|
50
|
+
## 1.0.0 — 2026-05-29
|
|
58
51
|
|
|
59
52
|
### Added
|
|
60
|
-
-
|
|
61
|
-
- 8 built-in calculation methods scoped per Madhab (Hanafi, Shafi, Maliki, Hanbali, Jaafari).
|
|
62
|
-
- High-latitude handling: Polar Day, Polar Night, Continuous Twilight with Astronomical Midnight fallback.
|
|
63
|
-
- Per-prayer minute adjustments via `adjustments` config.
|
|
64
|
-
- Elevation-based horizon dip correction.
|
|
65
|
-
- **Qibla module** (`src/qibla/`): great-circle bearing, rhumb-line bearing, and Haversine distance to the Kaaba.
|
|
66
|
-
- **Moon module** (`src/moon/`):
|
|
67
|
-
- Moon phase, elongation, illuminated fraction.
|
|
68
|
-
- Moon age (days since last New Moon).
|
|
69
|
-
- Lunar events: Next/Previous New Moon and Full Moon.
|
|
70
|
-
- Crescent visibility via Odeh, Yallop, and HMNAO criteria.
|
|
71
|
-
- **Astronomy engine** (`src/astronomy/`): VSOP87-derived solar ephemeris, lunar position theory, ΔT correction (ELP2000-style).
|
|
72
|
-
- Dual-module output (ESM + CJS) via `tsup`.
|
|
73
|
-
- TypeScript declaration files (`.d.ts` / `.d.cts`).
|
|
74
|
-
- Source maps.
|
|
75
|
-
- `sideEffects: false` for bundler tree-shaking.
|
|
76
|
-
- `prepublishOnly` script to gate `npm publish` behind a full build + test run.
|
|
77
|
-
- Comprehensive test suite with `vitest`.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
[Unreleased]: https://github.com/h-ghulam-hasnain/tauqeet-js/compare/v1.1.0...HEAD
|
|
82
|
-
[1.1.0]: https://github.com/h-ghulam-hasnain/tauqeet-js/compare/v1.0.0...v1.1.0
|
|
83
|
-
[1.0.0]: https://github.com/h-ghulam-hasnain/tauqeet-js/releases/tag/v1.0.0
|
|
53
|
+
- Initial public release with prayer times, Qibla, moon calculations, and Hijri conversion.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Ghulam Hasnain
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ghulam Hasnain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,140 +1,103 @@
|
|
|
1
1
|
# tauqeet-js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A high-precision TypeScript library for Islamic astronomical calculations, covering prayer times, Qibla direction, lunar events, Hijri conversion, and solar alignment.
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](CHANGELOG.md)
|
|
7
9
|
|
|
8
|
-
>
|
|
10
|
+
> Interactive reference: [https://tauqeet-js.web.app](https://tauqeet-js.web.app)
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
tauqeet-js provides numerically precise astronomical calculations using a VSOP87-based solar ephemeris, lunar theory, and ΔT corrections. The package is modular and tree-shakeable, so Node.js and browser applications can import only the modules they need.
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## What is tauqeet-js?
|
|
15
17
|
|
|
16
|
-
-
|
|
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)
|
|
18
|
+
tauqeet-js is a TypeScript-first library for Islamic astronomy. It helps applications compute:
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
- Prayer times for major prayer events such as Fajr, Sunrise, Dhuhr, Asr, Maghrib, and Isha.
|
|
21
|
+
- Qibla direction and distance to Mecca.
|
|
22
|
+
- Moon phase, moon age, lunar events, and visibility heuristics.
|
|
23
|
+
- Hijri calendar conversions and calendar-method helpers.
|
|
24
|
+
- Solar alignment events relative to the Qibla bearing.
|
|
28
25
|
|
|
29
|
-
|
|
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) |
|
|
26
|
+
The current release, v1.1.3, focuses on stable public exports, stronger validation, better diagnostics around timezone and formatting fallbacks, and measurable runtime improvements.
|
|
36
27
|
|
|
37
28
|
---
|
|
38
29
|
|
|
39
|
-
##
|
|
30
|
+
## Installation
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
- **TypeScript** ≥ 5 (for source usage)
|
|
43
|
-
- ESM-first; CJS bundle also provided.
|
|
32
|
+
Install with your preferred package manager:
|
|
44
33
|
|
|
45
|
-
|
|
34
|
+
```bash
|
|
35
|
+
npm install tauqeet-js
|
|
36
|
+
```
|
|
46
37
|
|
|
47
|
-
|
|
38
|
+
```bash
|
|
39
|
+
yarn add tauqeet-js
|
|
40
|
+
```
|
|
48
41
|
|
|
49
42
|
```bash
|
|
50
|
-
|
|
43
|
+
pnpm add tauqeet-js
|
|
51
44
|
```
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
The package ships ESM and CommonJS entry points, with per-module subpath exports for selective bundling.
|
|
54
47
|
|
|
55
48
|
---
|
|
56
49
|
|
|
57
50
|
## Quick Start
|
|
58
51
|
|
|
59
|
-
### Prayer Times
|
|
60
|
-
|
|
61
52
|
```ts
|
|
62
|
-
import { calculatePrayerTimes
|
|
53
|
+
import { calculatePrayerTimes } from 'tauqeet-js';
|
|
63
54
|
|
|
64
|
-
// London, UK – today
|
|
65
55
|
const result = calculatePrayerTimes({
|
|
66
56
|
lat: 51.5074,
|
|
67
57
|
long: -0.1278,
|
|
68
58
|
timeZone: 'Europe/London',
|
|
69
|
-
method: 'MWL',
|
|
59
|
+
method: 'MWL',
|
|
70
60
|
madhab: 'Shafi',
|
|
71
61
|
});
|
|
72
62
|
|
|
73
|
-
console.log(result.fajr.local);
|
|
74
|
-
console.log(result.dhuhr.local);
|
|
75
|
-
console.log(result.isha.local);
|
|
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`);
|
|
63
|
+
console.log(result.fajr.local);
|
|
64
|
+
console.log(result.dhuhr.local);
|
|
65
|
+
console.log(result.isha.local);
|
|
86
66
|
```
|
|
87
67
|
|
|
88
|
-
|
|
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
|
-
```
|
|
68
|
+
For a more resilient integration, see [API.md](API.md) and [ERROR_HANDLING.md](ERROR_HANDLING.md).
|
|
100
69
|
|
|
101
|
-
|
|
70
|
+
---
|
|
102
71
|
|
|
103
|
-
|
|
104
|
-
import { toHijri, HijriMethod, HIJRI_MONTH_NAMES } from 'tauqeet-js';
|
|
72
|
+
## Core Modules
|
|
105
73
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
74
|
+
| Module | What it provides |
|
|
75
|
+
|---|---|
|
|
76
|
+
| Prayers | Prayer-time calculations, formatting helpers, config validation, high-latitude handling |
|
|
77
|
+
| Qibla | Bearing and distance to the Kaaba |
|
|
78
|
+
| Moon | Phase, age, lunar events, crescent visibility heuristics |
|
|
79
|
+
| Hijri | Gregorian/Hijri conversion and calendar methods |
|
|
80
|
+
| Solar Alignment | Sun-at-Qibla alignment times |
|
|
109
81
|
|
|
110
82
|
---
|
|
111
83
|
|
|
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 |
|
|
84
|
+
## Documentation Set
|
|
120
85
|
|
|
121
|
-
|
|
86
|
+
- [API.md](API.md) — comprehensive API reference for public exports.
|
|
87
|
+
- [ERROR_HANDLING.md](ERROR_HANDLING.md) — error classes, Result wrappers, and diagnostics.
|
|
88
|
+
- [CONFIGURATION.md](CONFIGURATION.md) — prayer configuration, methods, high-latitude strategies, and timezone hooks.
|
|
89
|
+
- [PERFORMANCE.md](PERFORMANCE.md) — ephemerides, models, optimisations, and benchmarks.
|
|
90
|
+
- [CHANGELOG.md](CHANGELOG.md) — release notes and migration guidance.
|
|
122
91
|
|
|
123
92
|
---
|
|
124
93
|
|
|
125
|
-
##
|
|
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
|
-
```
|
|
94
|
+
## Highlights in v1.1.3
|
|
136
95
|
|
|
137
|
-
|
|
96
|
+
- Per-module exports for tree-shaking: [API.md](API.md)
|
|
97
|
+
- Optional fallback diagnostics for timezone and formatting issues
|
|
98
|
+
- More explicit validation for custom prayer angles
|
|
99
|
+
- Performance improvements in the astronomy hot path
|
|
100
|
+
- Improved error handling around timezone formatting and visibility calculations
|
|
138
101
|
|
|
139
102
|
---
|
|
140
103
|
|