panchang-ts 1.0.0 → 2.0.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/README.md +162 -53
- package/dist/index.cjs +1290 -237
- package/dist/index.d.cts +211 -18
- package/dist/index.d.ts +211 -18
- package/dist/index.js +1284 -238
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ Works offline in React Native (Hermes), Node.js, and browsers.
|
|
|
17
17
|
- [API Reference](#api-reference)
|
|
18
18
|
- [`getDailyPanchang`](#getdailypanchangdate-location-options)
|
|
19
19
|
- [`getInstantPanchang`](#getinstantpanchangdate-location-options)
|
|
20
|
+
- [When to use `getInstantPanchang` vs `getDailyPanchang`](#when-to-use-getinstantpanchang-vs-getdailypanchang)
|
|
20
21
|
- [Options](#options)
|
|
21
22
|
- [Low-level Utilities](#low-level-utilities)
|
|
22
23
|
- [Types](#types)
|
|
@@ -48,11 +49,13 @@ const result = getDailyPanchang(
|
|
|
48
49
|
{ latitude: 23.1765, longitude: 75.7885 }, // Ujjain, India
|
|
49
50
|
{ timezone: 330 }, // IST = UTC+5:30 = 330 minutes
|
|
50
51
|
);
|
|
52
|
+
// result is `DailyPanchangResult | null` — null only at polar latitudes
|
|
53
|
+
// where sunrise can't be computed. Anywhere else, narrow with `if (!result) return;`
|
|
51
54
|
|
|
52
55
|
// Pancha Anga
|
|
53
56
|
console.log(result.tithis[0].name); // "Krishna Chaturdashi"
|
|
54
57
|
console.log(result.nakshatras[0].name); // "Mrigashira"
|
|
55
|
-
console.log(result.vara.name); // "
|
|
58
|
+
console.log(result.vara.name); // "Mangalawara"
|
|
56
59
|
|
|
57
60
|
// Lunar calendar (Purnimanta by default)
|
|
58
61
|
console.log(result.chandramasa.name); // "Magha"
|
|
@@ -119,20 +122,13 @@ on a given calendar day, which is normal.
|
|
|
119
122
|
### Language & Masa System
|
|
120
123
|
|
|
121
124
|
```typescript
|
|
122
|
-
//
|
|
123
|
-
const sa = getDailyPanchang(date, location, {
|
|
124
|
-
timezone: 330,
|
|
125
|
-
language: 'sa',
|
|
126
|
-
});
|
|
127
|
-
console.log(sa.tithis[0].name); // "कृष्ण चतुर्दशी"
|
|
128
|
-
console.log(sa.vara.name); // "मङ्गलवारः"
|
|
129
|
-
|
|
130
|
-
// Hindi names
|
|
125
|
+
// Hindi names (Devanagari)
|
|
131
126
|
const hi = getDailyPanchang(date, location, {
|
|
132
127
|
timezone: 330,
|
|
133
128
|
language: 'hi',
|
|
134
129
|
});
|
|
135
130
|
console.log(hi.tithis[0].name); // "कृष्ण चतुर्दशी"
|
|
131
|
+
console.log(hi.vara.name); // "मंगलवार"
|
|
136
132
|
|
|
137
133
|
// Amanta (South Indian) masa system
|
|
138
134
|
const amanta = getDailyPanchang(date, location, {
|
|
@@ -154,22 +150,35 @@ Tithi, Nakshatra, Yoga, Karana, Vara — with transition times throughout the da
|
|
|
154
150
|
Chandra Masa with Adhika (leap month) detection, both **Purnimanta** (North Indian, default) and **Amanta** (South Indian) systems, Vikram Samvat, Shaka Samvat.
|
|
155
151
|
|
|
156
152
|
### Muhurta & Auspicious Timing
|
|
157
|
-
Brahma Muhurta, Abhijit Muhurta, Choghadiya (16 slots), Gowri Panchangam / Nalla Neram (16 slots), Hora (24 planetary hours), Dur Muhurta (2 inauspicious windows).
|
|
153
|
+
Brahma Muhurta, Abhijit Muhurta, Vijaya Muhurta (11th day-muhurta), Godhuli (sunset muhurta), Nishita (midnight muhurta, used for Shivaratri), nakshatra-keyed Amrit Kala. Choghadiya (16 slots), Gowri Panchangam / Nalla Neram (16 slots), Hora (24 planetary hours), Dur Muhurta (2 inauspicious windows).
|
|
158
154
|
|
|
159
155
|
### Inauspicious Periods
|
|
160
|
-
Rahu Kalam, Gulika Kalam, Yamaganda, Panchaka detection.
|
|
156
|
+
Rahu Kalam, Gulika Kalam, Yamaganda, Panchaka detection, Bhadra Kala (Vishti karana window with earth / heaven / paatal location).
|
|
161
157
|
|
|
162
158
|
### Special Yogas & Festivals
|
|
163
|
-
Amrit Siddhi, Sarvartha Siddhi, Ravi Pushya, Guru Pushya yoga detection.
|
|
159
|
+
Amrit Siddhi, Sarvartha Siddhi, Ravi Pushya, Guru Pushya yoga detection.
|
|
160
|
+
|
|
161
|
+
**60+ festivals** spanning pan-Indian, regional, and classical observances:
|
|
162
|
+
|
|
163
|
+
- **Ekadashi** — 26 named variants (Putrada, Shat Tila, Nirjala, Devshayani, etc.) with **Smarta / Vaishnava split** via Dashami-viddha rule; Smarta fast emits a `deferralDate` for Dwadashi.
|
|
164
|
+
- **Pradosha** — 7 weekday-qualified variants (Som Pradosh, Bhauma Pradosh, Shani Pradosh, etc.) firing on both Shukla & Krishna paksha.
|
|
165
|
+
- **Sankranti** — transit-based solar-month boundary detection plus regional variants (**Pongal**, **Vishu**, **Baisakhi**, **Magh Bihu**, **Ayyappa Makara Jyothi**) scoped by the `region` option.
|
|
166
|
+
- **Canonical-time classical festivals** — Ganesh Chaturthi (madhyahna), Shivaratri (nishita), Diwali, Holi, Raksha Bandhan (Bhadra-aware, suppressed when Bhadra straddles Purnima), Karva Chauth (chandrodaya), Janmashtami, Dussehra, Navaratri, Ram Navami, Hanuman Jayanti, **Akshaya Tritiya & Parashurama Jayanti** (madhyahna-vyapini, co-emitted on Vaishakha Shukla Tritiya), Makar Sankranti.
|
|
167
|
+
- **Regional & seasonal** — Chhath (4-day sequence), Vat Savitri, Upakarma (3 shakha variants via nakshatra+chandraMasa), Onam (nakshatra+solarMasa).
|
|
168
|
+
- **Monthly observances** — Masik Shivaratri, Vinayaka Chaturthi (suppressed in Maha-month), **Masik Karthigai** (any day Krittika nakshatra prevails — sampled at sunrise / midday / sunset / nishita), Pushya days, Shravan Somvar and other month+weekday patterns.
|
|
169
|
+
- Adhika (leap) months auto-skipped for tithi-based rules; Purnimanta naming respected.
|
|
170
|
+
|
|
171
|
+
### Eclipses (Grahan)
|
|
172
|
+
Solar & lunar eclipse detection with subtype (partial / total / annular / penumbral), magnitude at peak, observer-horizon visibility, and pre-eclipse **sutak** impurity window.
|
|
164
173
|
|
|
165
174
|
### Jyotish (Vedic Astrology)
|
|
166
175
|
All 9 graha positions (geocentric, sidereal) with rashi, nakshatra, pada, and retrograde status. Vimshottari Dasha with Antardasha breakdown — from a birth moment alone or from an explicit Moon longitude. Chandra Balam (transit-Moon favorability relative to janma rashi).
|
|
167
176
|
|
|
168
177
|
### Astronomy
|
|
169
|
-
Sunrise, Sunset, Moonrise, Moonset, Chandra Rashi (Moon sign), Surya Nakshatra.
|
|
178
|
+
Sunrise, Sunset, Moonrise, Moonset, Chandra Rashi (Moon sign), Surya Nakshatra. Cross-verified across diaspora locations (New York, London, Sydney, Dubai, Singapore) including DST transitions via IANA timezone strings.
|
|
170
179
|
|
|
171
180
|
### Localization
|
|
172
|
-
|
|
181
|
+
2 languages: **English** and **Hindi** (Devanagari). All returned display strings respect the `language` option.
|
|
173
182
|
|
|
174
183
|
### Configuration
|
|
175
184
|
3 ayanamsa systems (Lahiri, B.V. Raman, KP), 2 masa systems (Purnimanta, Amanta), adjustable precision, optional fast mode (`computeEndTimes: false` for ~5x speedup).
|
|
@@ -192,7 +201,9 @@ const result = getDailyPanchang(
|
|
|
192
201
|
);
|
|
193
202
|
```
|
|
194
203
|
|
|
195
|
-
**Returns: `DailyPanchangResult`**
|
|
204
|
+
**Returns: `DailyPanchangResult | null`**
|
|
205
|
+
|
|
206
|
+
`null` is returned for polar locations on dates where sunrise or sunset cannot be computed (midnight sun, polar night). On every other location/date the function returns a populated result.
|
|
196
207
|
|
|
197
208
|
| Field | Type | Description |
|
|
198
209
|
|-------|------|-------------|
|
|
@@ -227,7 +238,14 @@ const result = getDailyPanchang(
|
|
|
227
238
|
| `panchaka` | `boolean` | `true` when Moon is in last 5 nakshatras |
|
|
228
239
|
| `specialYogas` | `SpecialYogaInfo[]` | Auspicious yogas active today |
|
|
229
240
|
| `durMuhurta` | `[TimePeriod, TimePeriod]` | Two inauspicious ~48-min windows |
|
|
230
|
-
| `
|
|
241
|
+
| `vijayaMuhurta` | `TimePeriod` | Vijaya Muhurta — 11th day-muhurta, auspicious for success |
|
|
242
|
+
| `godhuliMuhurta` | `TimePeriod` | Godhuli ("cow-dust") — sunset muhurta, auspicious for ceremonies |
|
|
243
|
+
| `nishitaMuhurta` | `TimePeriod` | Nishita — midnight muhurta, used for Shivaratri and nocturnal rites |
|
|
244
|
+
| `amritKala` | `TimePeriod \| null` | Amrit Kala — nakshatra-specific auspicious window (null when nakshatra has none) |
|
|
245
|
+
| `bhadra` | `BhadraInfo \| null` | Bhadra Kala (Vishti karana) window overlapping this Hindu day, or `null` |
|
|
246
|
+
| `eclipse` | `EclipseInfo \| null` | Solar/lunar eclipse overlapping this Hindu day with sutak window, or `null` |
|
|
247
|
+
| `festivals` | `FestivalInfo[]` | Festivals / observances today (filtered by `region` option) |
|
|
248
|
+
| `chandraBalam` | `ChandraBalamInfo?` | Transit-Moon favorability — only present when `janmaRashi` option is passed |
|
|
231
249
|
| `ayanamsa` | `number` | Ayanamsa in degrees at sunrise |
|
|
232
250
|
| `siderealSunAtSunrise` | `number` | Sun sidereal longitude at sunrise (degrees) |
|
|
233
251
|
| `siderealMoonAtSunrise` | `number` | Moon sidereal longitude at sunrise (degrees) |
|
|
@@ -244,7 +262,7 @@ import { getInstantPanchang } from 'panchang-ts';
|
|
|
244
262
|
const result = getInstantPanchang(
|
|
245
263
|
new Date('2025-01-14T03:00:00Z'), // UTC moment
|
|
246
264
|
{ latitude: 18.5204, longitude: 73.8567 },
|
|
247
|
-
{ language: '
|
|
265
|
+
{ language: 'hi' }, // Hindi (Devanagari) names
|
|
248
266
|
);
|
|
249
267
|
|
|
250
268
|
console.log(result.tithi.name); // "कृष्ण चतुर्दशी"
|
|
@@ -255,7 +273,9 @@ console.log(result.samvat.vikramSamvat); // 2081
|
|
|
255
273
|
console.log(result.panchaka); // false
|
|
256
274
|
```
|
|
257
275
|
|
|
258
|
-
**Returns: `InstantPanchangResult`**
|
|
276
|
+
**Returns: `InstantPanchangResult | null`**
|
|
277
|
+
|
|
278
|
+
`null` is returned for polar locations where sunrise can't be computed (the Hindu-day weekday is undefined). On every other location/date the function returns a populated result.
|
|
259
279
|
|
|
260
280
|
| Field | Type | Description |
|
|
261
281
|
|-------|------|-------------|
|
|
@@ -272,27 +292,50 @@ console.log(result.panchaka); // false
|
|
|
272
292
|
| `suryaNakshatra` | `RashiInfo` | Sun's nakshatra |
|
|
273
293
|
| `panchaka` | `boolean` | `true` when Moon is in last 5 nakshatras |
|
|
274
294
|
| `specialYogas` | `SpecialYogaInfo[]` | Auspicious yogas at this moment |
|
|
275
|
-
| `festivals` | `FestivalInfo[]` | Festivals / observances at this moment |
|
|
295
|
+
| `festivals` | `FestivalInfo[]` | Festivals / observances at this moment (see caveat below) |
|
|
296
|
+
| `chandraBalam` | `ChandraBalamInfo?` | Transit-Moon favorability — only present when `janmaRashi` option is passed |
|
|
276
297
|
| `ayanamsa` | `number` | Ayanamsa in degrees |
|
|
277
298
|
| `siderealSun` | `number` | Sun sidereal longitude (degrees) |
|
|
278
299
|
| `siderealMoon` | `number` | Moon sidereal longitude (degrees) |
|
|
279
300
|
|
|
280
301
|
---
|
|
281
302
|
|
|
303
|
+
### When to use `getInstantPanchang` vs `getDailyPanchang`
|
|
304
|
+
|
|
305
|
+
Both functions share the same core astronomy, but `getDailyPanchang` operates on the full Vedic day (local sunrise → next sunrise) while `getInstantPanchang` samples a single UTC moment. That distinction matters most for **festivals** and classical rules that reference a specific canonical time of the Hindu day.
|
|
306
|
+
|
|
307
|
+
| Use case | Recommended | Why |
|
|
308
|
+
|----------|-------------|-----|
|
|
309
|
+
| "What Panchang elements are active right now?" | `getInstantPanchang` | Single-moment snapshot; no sunrise needed. |
|
|
310
|
+
| Birth chart / muhurta picking at a specific instant | `getInstantPanchang` | Exact element at that UTC moment. |
|
|
311
|
+
| Daily calendar / almanac row for a date | `getDailyPanchang` | Lists all element transitions for the day. |
|
|
312
|
+
| Displaying today's festivals & observances | `getDailyPanchang` | Full canonical-time festival refinement. |
|
|
313
|
+
| Sankranti / solar-month boundary dates | `getDailyPanchang` | Uses sunrise-to-next-sunrise transit detection. |
|
|
314
|
+
| Ekadashi (Smarta vs Vaishnava), Shivaratri, Ganesh Chaturthi, Karva Chauth | `getDailyPanchang` | Requires madhyahna / pradosha / nishita / chandrodaya refinement. |
|
|
315
|
+
| Raksha Bandhan date (Bhadra-aware) / long-tithi dedupe | `getDailyPanchang` | Rules key off the Hindu day window, not an instant. |
|
|
316
|
+
| Rahu Kalam / Gulika / Choghadiya / Gowri / Hora / Durmuhurta | `getDailyPanchang` | Computed from sunrise, sunset, and day length. |
|
|
317
|
+
| Eclipse (Grahan) detection with sutak window | `getDailyPanchang` | Overlapping the day needs the day window. |
|
|
318
|
+
|
|
319
|
+
**Instant-mode festival caveat:** `getInstantPanchang` does emit `festivals`, but it evaluates rules against the tithi / nakshatra / chandraMasa at the given instant only. It **does not** run the canonical-time refinements (madhyahna / pradosha / nishita / chandrodaya), transit-based Sankranti, Ekadashi viddha (Smarta/Vaishnava split), or Bhadra-aware Raksha Bandhan exclusion — those require the full sunrise-to-next-sunrise Hindu day window and are only available in `getDailyPanchang`. If you need reliable festival dating, use `getDailyPanchang`.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
282
323
|
### Options
|
|
283
324
|
|
|
284
325
|
**`PanchangOptions`** (required for `getDailyPanchang`):
|
|
285
326
|
|
|
286
327
|
| Option | Type | Default | Description |
|
|
287
328
|
|--------|------|---------|-------------|
|
|
288
|
-
| `timezone` | `number \| string` | **required** | UTC offset in minutes (330 for IST).
|
|
329
|
+
| `timezone` | `number \| string` | **required** | UTC offset in minutes (330 for IST) **or** IANA zone name (`'America/New_York'`). IANA strings require `Intl` — use a number on older Hermes. DST resolves automatically for IANA zones via the reference date. |
|
|
289
330
|
| `ayanamsa` | `'lahiri' \| 'raman' \| 'krishnamurti'` | `'lahiri'` | Ayanamsa system |
|
|
290
|
-
| `language` | `'en' \| '
|
|
331
|
+
| `language` | `'en' \| 'hi'` | `'en'` | Language for all element names (English or Hindi Devanagari). |
|
|
291
332
|
| `computeEndTimes` | `boolean` | `true` | Set `false` for ~5x faster, names-only output |
|
|
292
333
|
| `precision` | `'standard' \| 'high'` | `'standard'` | Binary-search iterations (15 vs 25). High precision is rarely needed. |
|
|
293
334
|
| `masaSystem` | `'purnimanta' \| 'amanta'` | `'purnimanta'` | Lunar month naming system. Purnimanta (North Indian) or Amanta (South Indian). |
|
|
335
|
+
| `region` | `FestivalRegion` | `'all'` | Scopes regional festival variants (Pongal, Vishu, Baisakhi, Bihu, Ayyappa, etc.). See [`FestivalRegion`](#types) for supported values. The canonical pan-Indian `sankranti` event is always emitted regardless. |
|
|
336
|
+
| `janmaRashi` | `number` | _(omitted)_ | Native's birth Moon rashi index (0 = Mesha … 11 = Meena). When provided, the result includes `chandraBalam`. |
|
|
294
337
|
|
|
295
|
-
**`InstantPanchangOptions`** (optional for `getInstantPanchang`): same as above but without `timezone
|
|
338
|
+
**`InstantPanchangOptions`** (optional for `getInstantPanchang`): same as above but without `timezone` (instant mode works in UTC).
|
|
296
339
|
|
|
297
340
|
---
|
|
298
341
|
|
|
@@ -308,7 +351,11 @@ import {
|
|
|
308
351
|
getAyanamsa,
|
|
309
352
|
computeRahuKalam, computeGulikaKalam, computeYamaganda,
|
|
310
353
|
computeAbhijitMuhurta, computeBrahmaMuhurta,
|
|
354
|
+
computeVijayaMuhurta, computeGodhuliMuhurta,
|
|
355
|
+
computeNishitaMuhurta, computeAmritKala,
|
|
311
356
|
computeGowriPanchangam,
|
|
357
|
+
// Eclipses (signature: (fromUtc, location, withinDays))
|
|
358
|
+
getUpcomingSolarEclipse, getUpcomingLunarEclipse, getEclipseDuringDay,
|
|
312
359
|
// Jyotish
|
|
313
360
|
computePlanetaryPositions,
|
|
314
361
|
computeVimshottariDasha, computeVimshottariDashaFromBirth,
|
|
@@ -419,7 +466,7 @@ interface DailyTithiInfo extends TithiInfo {
|
|
|
419
466
|
|
|
420
467
|
interface VaraInfo {
|
|
421
468
|
index: number; // 0 = Sunday ... 6 = Saturday
|
|
422
|
-
name: string; // e.g. "
|
|
469
|
+
name: string; // e.g. "Raviwara" (localized)
|
|
423
470
|
shortName: string; // e.g. "Ravi" (localized)
|
|
424
471
|
englishName: string; // e.g. "Sunday" (always English)
|
|
425
472
|
}
|
|
@@ -520,9 +567,66 @@ interface SpecialYogaInfo {
|
|
|
520
567
|
}
|
|
521
568
|
|
|
522
569
|
interface FestivalInfo {
|
|
523
|
-
name: string; // e.g. "Diwali", "Ekadashi"
|
|
524
|
-
type:
|
|
525
|
-
|
|
570
|
+
name: string; // e.g. "Diwali", "Putrada Ekadashi", "Som Pradosh"
|
|
571
|
+
type:
|
|
572
|
+
| 'major' // Diwali, Holi, Raksha Bandhan, Navaratri, Sankranti variants ...
|
|
573
|
+
| 'minor' // Masik Shivaratri, Vinayaka Chaturthi, Pushya days, Shravan Somvar ...
|
|
574
|
+
| 'ekadashi' // Generic Ekadashi (when Smarta/Vaishnava split doesn't apply)
|
|
575
|
+
| 'smarta_ekadashi' // Smarta fast day; emits `deferralDate` when Dashami-viddha
|
|
576
|
+
| 'vaishnava_ekadashi' // Vaishnava fast day (observed on following day if Smarta defers)
|
|
577
|
+
| 'pradosha' // Weekday-qualified Pradosha (Som / Bhauma / Shani / etc.)
|
|
578
|
+
| 'sankranti' // Solar-month boundary (pan-Indian + regional variants)
|
|
579
|
+
| 'eclipse'; // Solar or lunar Grahan
|
|
580
|
+
description?: string;
|
|
581
|
+
/** Smarta-only: when Ekadashi is Dashami-viddha, the Dwadashi fast date. */
|
|
582
|
+
deferralDate?: Date;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
type FestivalRegion =
|
|
586
|
+
| 'all' // default — emits every regional variant
|
|
587
|
+
| 'north-india'
|
|
588
|
+
| 'tamil'
|
|
589
|
+
| 'kerala'
|
|
590
|
+
| 'bengal'
|
|
591
|
+
| 'punjab'
|
|
592
|
+
| 'gujarat'
|
|
593
|
+
| 'assam'
|
|
594
|
+
| 'maharashtra';
|
|
595
|
+
```
|
|
596
|
+
</details>
|
|
597
|
+
|
|
598
|
+
<details>
|
|
599
|
+
<summary><strong>Eclipses (Grahan)</strong> — EclipseInfo</summary>
|
|
600
|
+
|
|
601
|
+
```typescript
|
|
602
|
+
type EclipseSubtype = 'partial' | 'total' | 'annular' | 'penumbral';
|
|
603
|
+
|
|
604
|
+
interface EclipseInfo {
|
|
605
|
+
kind: 'solar' | 'lunar';
|
|
606
|
+
subtype: EclipseSubtype;
|
|
607
|
+
start: Date; // UTC — observable phase begins
|
|
608
|
+
peak: Date; // UTC — greatest eclipse
|
|
609
|
+
end: Date; // UTC — observable phase ends
|
|
610
|
+
visibleFromLocation: boolean; // body above horizon at peak for observer
|
|
611
|
+
magnitude: number; // fraction of disc obscured at peak, [0, 1]
|
|
612
|
+
sutakStart: Date; // pre-eclipse impurity window begins — 12 h (4 prahara) before for solar, 9 h (3 prahara) before for lunar, per classical Smarta convention
|
|
613
|
+
sutakEnd: Date; // coincides with eclipse end (moksha)
|
|
614
|
+
description: string;
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
</details>
|
|
618
|
+
|
|
619
|
+
<details>
|
|
620
|
+
<summary><strong>Bhadra Kala</strong> — BhadraInfo</summary>
|
|
621
|
+
|
|
622
|
+
```typescript
|
|
623
|
+
interface BhadraInfo {
|
|
624
|
+
start: Date;
|
|
625
|
+
end: Date;
|
|
626
|
+
/** Loka: 'earth' = malefic for all work; 'heaven' / 'paatal' = non-terrestrial, milder. */
|
|
627
|
+
location: 'earth' | 'heaven' | 'paatal';
|
|
628
|
+
/** True when Bhadra is active at some point during the Hindu day window. */
|
|
629
|
+
isActive: boolean;
|
|
526
630
|
}
|
|
527
631
|
```
|
|
528
632
|
</details>
|
|
@@ -613,42 +717,44 @@ InteractionManager.runAfterInteractions(() => {
|
|
|
613
717
|
|
|
614
718
|
## Accuracy
|
|
615
719
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
720
|
+
5,073 tests passing, including fixtures cross-verified against
|
|
721
|
+
reference panchang calculations spanning 2025–2026 across Delhi, Chennai,
|
|
722
|
+
New York, London, Sydney, Dubai, and Singapore (diaspora fixtures cover
|
|
723
|
+
DST transitions on `America/New_York`).
|
|
619
724
|
|
|
620
725
|
| Element | Accuracy | Validation |
|
|
621
726
|
|---------|----------|------------|
|
|
622
|
-
| Sunrise / Sunset | **≤29 s observed vs
|
|
623
|
-
| Moonrise / Moonset |
|
|
624
|
-
| Tithi, Nakshatra, Yoga, Karana names | Exact match vs
|
|
727
|
+
| Sunrise / Sunset | **≤29 s observed vs reference minute-midpoint** (±45 s tolerance) | 16 assertions |
|
|
728
|
+
| Moonrise / Moonset | Meeus apparent-upper-limb convention (refraction + parallax); ~3–5 min disagreement vs panchang authorities that use a simpler horizon model is expected and documented | Strict fixtures |
|
|
729
|
+
| Tithi, Nakshatra, Yoga, Karana names | Exact match vs reference | Strict fixtures |
|
|
625
730
|
| Tithi / Nakshatra / Yoga / Karana end-times | **±3 min tolerance, max 2.01 min observed** | 20 assertions |
|
|
626
731
|
| Ayanamsa | ±0.005° vs Swiss Ephemeris | Unit tests |
|
|
627
|
-
| Planetary positions (Sun–Saturn) | **±0.02° vs
|
|
628
|
-
| Planetary positions (Rahu/Ketu, mean node) | ≤0.5° typical; ±2° tolerance to absorb mean-vs-true drift |
|
|
629
|
-
| Rashi / Nakshatra / Retrograde flag | Exact match vs
|
|
630
|
-
| Festival dates | 12
|
|
732
|
+
| Planetary positions (Sun–Saturn) | **±0.02° vs reference sidereal** | Fixtures |
|
|
733
|
+
| Planetary positions (Rahu/Ketu, mean node) | ≤0.5° typical; ±2° tolerance to absorb mean-vs-true drift | Fixtures |
|
|
734
|
+
| Rashi / Nakshatra / Retrograde flag | Exact match vs reference | Fixtures |
|
|
735
|
+
| Festival dates | 12 cross-verified festivals (2025–2026) — see caveats below | Fixtures |
|
|
631
736
|
| Choghadiya / Hora / Gowri slots | Derived from sunrise/sunset — inherits ±2 min | — |
|
|
632
737
|
|
|
633
738
|
### Festival Detection — Documented Tradeoff
|
|
634
739
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
740
|
+
The library uses **tithi-at-sunrise** to resolve a festival to a calendar
|
|
741
|
+
day. Some traditional panchang authorities apply other classical rules
|
|
742
|
+
(tithi-at-midnight, madhyahna-vyapini, kshaya-tithi handling) for certain
|
|
743
|
+
festivals; where those rules pick a different day, our output can drift
|
|
744
|
+
±1 day. This is a rule-choice tradeoff, not a computation bug — it is
|
|
745
|
+
documented and deliberately surfaced rather than hidden.
|
|
640
746
|
|
|
641
|
-
|
|
|
642
|
-
|
|
747
|
+
| Alternative classical rule | Festivals affected |
|
|
748
|
+
|----------------------------|--------------------|
|
|
643
749
|
| Tithi-at-midnight | Krishna Janmashtami, Maha Shivaratri, Diwali / Lakshmi Puja |
|
|
644
750
|
| Madhyahna-vyapini (tithi overlapping noon) | Ganesh Chaturthi on edge years, Akshaya Tritiya 2026 |
|
|
645
|
-
| Kshaya-tithi handling (tithi never at sunrise) | Ugadi 2026-03-19 (
|
|
751
|
+
| Kshaya-tithi handling (tithi never at sunrise) | Ugadi 2026-03-19 (Pratipada is Kshaya) |
|
|
646
752
|
|
|
647
|
-
If
|
|
648
|
-
|
|
649
|
-
— Holi, Ugadi (non-Kshaya years), Rama Navami, Raksha Bandhan,
|
|
650
|
-
Chaturthi (normal years), Navaratri, Dussehra, Karva Chauth,
|
|
651
|
-
Jayanti — matches
|
|
753
|
+
If strict parity with a specific panchang authority matters for your use
|
|
754
|
+
case, cross-check the above festival set for the target year. Everything
|
|
755
|
+
else — Holi, Ugadi (non-Kshaya years), Rama Navami, Raksha Bandhan,
|
|
756
|
+
Ganesh Chaturthi (normal years), Navaratri, Dussehra, Karva Chauth,
|
|
757
|
+
Hanuman Jayanti — matches the canonical date across 2025 and 2026 fixtures.
|
|
652
758
|
|
|
653
759
|
---
|
|
654
760
|
|
|
@@ -670,7 +776,7 @@ try {
|
|
|
670
776
|
getDailyPanchang(date, location, options);
|
|
671
777
|
} catch (e) {
|
|
672
778
|
if (e instanceof PanchangError) {
|
|
673
|
-
console.error(e.code); // e.g. 'INVALID_LATITUDE', '
|
|
779
|
+
console.error(e.code); // e.g. 'INVALID_LATITUDE', 'INVALID_TIMEZONE'
|
|
674
780
|
console.error(e.message);
|
|
675
781
|
}
|
|
676
782
|
}
|
|
@@ -680,8 +786,11 @@ Error codes: `INVALID_DATE`, `INVALID_LATITUDE`, `INVALID_LONGITUDE`,
|
|
|
680
786
|
`INVALID_ELEVATION`, `INVALID_TIMEZONE`, `INVALID_AYANAMSA`, `TIMEZONE_RESOLUTION_FAILED`,
|
|
681
787
|
`NO_SUNRISE`, `NO_SUNSET`, `SEARCH_DIVERGED`.
|
|
682
788
|
|
|
683
|
-
|
|
684
|
-
|
|
789
|
+
**Polar locations (no sunrise / no sunset):** `getDailyPanchang` and `getInstantPanchang`
|
|
790
|
+
return `null` rather than throwing — the Hindu day is undefined when sunrise can't be
|
|
791
|
+
computed. The low-level `computeSunrise` / `computeSunset` primitives still throw
|
|
792
|
+
`PanchangError(NO_SUNRISE)` / `PanchangError(NO_SUNSET)` for direct callers who need
|
|
793
|
+
the precise reason. `getMoonrise` / `getMoonset` return `null` (normal for the Moon).
|
|
685
794
|
|
|
686
795
|
---
|
|
687
796
|
|