panchang-ts 2.1.0 → 2.4.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 CHANGED
@@ -72,7 +72,11 @@ console.log(result.moonrise); // Date | null
72
72
 
73
73
  // Muhurta & inauspicious periods
74
74
  console.log(result.brahmaMuhurta); // { start: Date, end: Date }
75
+ console.log(result.madhyahna); // solar noon ±24 min
75
76
  console.log(result.rahuKalam); // { start: Date, end: Date }
77
+ console.log(result.anandadiYoga.name); // "Ananda" (Vara × Nakshatra cycle)
78
+ console.log(result.gandaMula.active); // false (or true with severity)
79
+ console.log(result.varjyam); // { start, end } | null
76
80
 
77
81
  // Choghadiya — 8 daytime slots
78
82
  result.choghadiya.day.forEach(slot => {
@@ -181,13 +185,13 @@ Tithi, Nakshatra, Yoga, Karana, Vara — with transition times throughout the da
181
185
  Chandra Masa with Adhika (leap month) detection, both **Purnimanta** (North Indian, default) and **Amanta** (South Indian) systems, Vikram Samvat, Shaka Samvat.
182
186
 
183
187
  ### Muhurta & Auspicious Timing
184
- 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).
188
+ Brahma Muhurta, Abhijit Muhurta, Vijaya Muhurta (11th day-muhurta), Godhuli (sunset muhurta), Nishita (midnight muhurta, used for Shivaratri), **Madhyahna** (solar noon ±24 min ritual window), **Pratah Sandhya** / **Sayahna Sandhya** (asymmetric dawn / dusk twilight windows, width = `nightDuration / 10` — ~62–81 min depending on season, ending *at* sunrise / starting *at* sunset; matches DrikPanchang within ±2 min), classical aliases `dinamanaMinutes` / `ratrimanaMinutes`, nakshatra-keyed Amrit Kala. Choghadiya (16 slots), Gowri Panchangam / Nalla Neram (16 slots), Hora (24 planetary hours), Dur Muhurta (2 inauspicious windows), **Do Ghati Muhurta** (15 day + 15 night ~48-min slots, deity-keyed, no vara rotation), **Panchaka Rahita Muhurta** (slices of the day free of Panchaka), **Anandadi Yoga** (28-name Vara × Nakshatra cycle).
185
189
 
186
190
  ### Inauspicious Periods
187
- Rahu Kalam, Gulika Kalam, Yamaganda, Panchaka detection, Bhadra Kala (Vishti karana window with earth / heaven / paatal location).
191
+ Rahu Kalam, Gulika Kalam, Yamaganda, Panchaka detection, Bhadra Kala (Vishti karana window with earth / heaven / paatal location), **Varjyam** (BPHS-keyed forbidden ~96-min window per nakshatra), **Ganda Mula** (Moon in the 6 root nakshatras — Ashwini / Ashlesha / Magha / Jyeshtha / Mula / Revati — with `mild` / `severe` severity).
188
192
 
189
193
  ### Special Yogas & Festivals
190
- Amrit Siddhi, Sarvartha Siddhi, Ravi Pushya, Guru Pushya yoga detection.
194
+ Amrit Siddhi, Sarvartha Siddhi, Ravi Pushya, Guru Pushya, **Dwipushkar**, **Tripushkar**, **Jwalamukhi**, **Aadal**, **Vidaal**, **Ravi** yoga detection.
191
195
 
192
196
  **80+ festivals** spanning pan-Indian, regional, and classical observances:
193
197
 
@@ -204,7 +208,7 @@ Amrit Siddhi, Sarvartha Siddhi, Ravi Pushya, Guru Pushya yoga detection.
204
208
  Solar & lunar eclipse detection with subtype (partial / total / annular / penumbral), magnitude at peak, observer-horizon visibility, and pre-eclipse **sutak** impurity window.
205
209
 
206
210
  ### Jyotish (Vedic Astrology)
207
- 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).
211
+ 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). **Tarabala** (9-tara cycle — Janma, Sampat, Vipat, Kshema, Pratyari, Sadhaka, Vadha, Mitra, Ati-Mitra — keyed off janma nakshatra; parallel to Chandra Balam).
208
212
 
209
213
  ### Astronomy
210
214
  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.
@@ -268,16 +272,27 @@ const result = getDailyPanchang(
268
272
  | `moonrise` | `Date \| null` | Moonrise; `null` if none that day |
269
273
  | `moonset` | `Date \| null` | Moonset; `null` if none that day |
270
274
  | `panchaka` | `boolean` | `true` when Moon is in last 5 nakshatras |
275
+ | `panchakaRahita` | `TimePeriod[]` | Slices of the Hindu day FREE of Panchaka; `[]` when Panchaka pervades the entire day |
276
+ | `doGhatiMuhurta` | `DoGhatiInfo` | 15 day + 15 night ~48-min deity-keyed slots covering sunrise→sunset and sunset→nextSunrise |
277
+ | `gandaMula` | `GandaMulaInfo` | Moon-in-root-nakshatra detection at sunrise; `active: false` for the 21 non-root nakshatras |
278
+ | `anandadiYoga` | `AnandadiYogaInfo` | Vara × Nakshatra 28-name cycle yoga at sunrise |
271
279
  | `specialYogas` | `SpecialYogaInfo[]` | Auspicious yogas active today |
272
280
  | `durMuhurta` | `[TimePeriod, TimePeriod]` | Two inauspicious ~48-min windows |
273
281
  | `vijayaMuhurta` | `TimePeriod` | Vijaya Muhurta — 11th day-muhurta, auspicious for success |
274
282
  | `godhuliMuhurta` | `TimePeriod` | Godhuli ("cow-dust") — sunset muhurta, auspicious for ceremonies |
275
283
  | `nishitaMuhurta` | `TimePeriod` | Nishita — midnight muhurta, used for Shivaratri and nocturnal rites |
284
+ | `madhyahna` | `TimePeriod` | Madhyahna — solar noon as a ±24-min ritual window (one classical muhurta wide) |
285
+ | `pratahSandhya` | `TimePeriod` | Dawn-twilight ritual window — three nighttime ghatikas ending *at* sunrise (asymmetric; width = `nightDuration / 10` ≈ 62–81 min) |
286
+ | `sayahnaSandhya` | `TimePeriod` | Dusk-twilight ritual window — three nighttime ghatikas starting *at* sunset (asymmetric; width = `nightDuration / 10`) |
287
+ | `dinamanaMinutes` | `number` | Classical alias of `dayDurationMinutes` (sunrise → sunset) |
288
+ | `ratrimanaMinutes` | `number` | Classical alias of `nightDurationMinutes` (sunset → next sunrise) |
276
289
  | `amritKala` | `TimePeriod \| null` | Amrit Kala — nakshatra-specific auspicious window (null when nakshatra has none) |
290
+ | `varjyam` | `TimePeriod \| null` | Varjyam (Vishaghati / Nakshatra Thyajyam) — BPHS-keyed forbidden ~96-min window; `null` when none overlaps the Hindu day |
277
291
  | `bhadra` | `BhadraInfo \| null` | Bhadra Kala (Vishti karana) window overlapping this Hindu day, or `null` |
278
292
  | `eclipse` | `EclipseInfo \| null` | Solar/lunar eclipse overlapping this Hindu day with sutak window, or `null` |
279
293
  | `festivals` | `FestivalInfo[]` | Festivals / observances today (filtered by `region` option) |
280
294
  | `chandraBalam` | `ChandraBalamInfo?` | Transit-Moon favorability — only present when `janmaRashi` option is passed |
295
+ | `tarabala` | `TarabalaInfo?` | 9-tara cycle position — only present when `janmaNakshatra` option is passed |
281
296
  | `ayanamsa` | `number` | Ayanamsa in degrees at sunrise |
282
297
  | `siderealSunAtSunrise` | `number` | Sun sidereal longitude at sunrise (degrees) |
283
298
  | `siderealMoonAtSunrise` | `number` | Moon sidereal longitude at sunrise (degrees) |
@@ -323,9 +338,12 @@ console.log(result.panchaka); // false
323
338
  | `chandraRashi` | `RashiInfo` | Moon's zodiac sign |
324
339
  | `suryaNakshatra` | `RashiInfo` | Sun's nakshatra |
325
340
  | `panchaka` | `boolean` | `true` when Moon is in last 5 nakshatras |
341
+ | `gandaMula` | `GandaMulaInfo` | Moon-in-root-nakshatra detection at the queried instant |
342
+ | `anandadiYoga` | `AnandadiYogaInfo` | Vara × Nakshatra 28-name cycle yoga at the queried instant |
326
343
  | `specialYogas` | `SpecialYogaInfo[]` | Auspicious yogas at this moment |
327
344
  | `festivals` | `FestivalInfo[]` | Festivals / observances at this moment (see caveat below) |
328
345
  | `chandraBalam` | `ChandraBalamInfo?` | Transit-Moon favorability — only present when `janmaRashi` option is passed |
346
+ | `tarabala` | `TarabalaInfo?` | 9-tara cycle position — only present when `janmaNakshatra` option is passed |
329
347
  | `ayanamsa` | `number` | Ayanamsa in degrees |
330
348
  | `siderealSun` | `number` | Sun sidereal longitude (degrees) |
331
349
  | `siderealMoon` | `number` | Moon sidereal longitude (degrees) |
@@ -366,6 +384,7 @@ Both functions share the same core astronomy, but `getDailyPanchang` operates on
366
384
  | `masaSystem` | `'purnimanta' \| 'amanta'` | `'purnimanta'` | Lunar month naming system. Purnimanta (North Indian) or Amanta (South Indian). |
367
385
  | `region` | `FestivalRegion` | `'all'` | Scopes regional festival variants (Pongal, Vishu, Gudi Padwa, Lohri, Govardhan Puja, Bonalu, …) to a specific Indian state. See [`FestivalRegion`](#types) for the full list. Pre-v2.1 values (`'tamil'`, `'bengal'`, `'north-india'`) are still accepted but emit a deprecation warning; removal in v3. Pan-Indian festivals and the canonical `sankranti` event emit regardless of this setting. |
368
386
  | `janmaRashi` | `number` | _(omitted)_ | Native's birth Moon rashi index (0 = Mesha … 11 = Meena). When provided, the result includes `chandraBalam`. |
387
+ | `janmaNakshatra` | `number` | _(omitted)_ | Native's birth Moon nakshatra index (0 = Ashwini … 26 = Revati). When provided, the result includes `tarabala`. |
369
388
 
370
389
  **`InstantPanchangOptions`** (optional for `getInstantPanchang`): same as above but without `timezone` (instant mode works in UTC).
371
390
 
@@ -385,6 +404,10 @@ import {
385
404
  computeAbhijitMuhurta, computeBrahmaMuhurta,
386
405
  computeVijayaMuhurta, computeGodhuliMuhurta,
387
406
  computeNishitaMuhurta, computeAmritKala,
407
+ // Phase 28 — daily-parity muhurtas + nakshatra-keyed inauspicious windows
408
+ computeMadhyahna, computePratahSandhya, computeSayahnaSandhya,
409
+ computeVarjyam, computeGandaMula,
410
+ computeAnandadiYoga, computePanchakaRahita, computeDoGhati,
388
411
  computeGowriPanchangam,
389
412
  // Eclipses (signature: (fromUtc, location, withinDays))
390
413
  getUpcomingSolarEclipse, getUpcomingLunarEclipse, getEclipseDuringDay,
@@ -392,6 +415,7 @@ import {
392
415
  computePlanetaryPositions,
393
416
  computeVimshottariDasha, computeVimshottariDashaFromBirth,
394
417
  computeChandraBalam,
418
+ computeTarabala,
395
419
  GRAHA_ABBR,
396
420
  } from 'panchang-ts';
397
421
 
@@ -444,6 +468,13 @@ const cb = computeChandraBalam(3 /* Karka */, 6 /* Tula */);
444
468
  console.log(cb.house); // 4
445
469
  console.log(cb.quality); // "weak"
446
470
  console.log(cb.englishName); // "Ashubha"
471
+
472
+ // Tarabala — 9-tara cycle from janma nakshatra → transit Moon nakshatra.
473
+ // Inputs are 0-indexed nakshatra (0 = Ashwini ... 26 = Revati).
474
+ const tb = computeTarabala(0 /* janma: Ashwini */, 4 /* transit: Mrigashira */);
475
+ console.log(tb.taraIndex); // 4
476
+ console.log(tb.englishName); // "Pratyari"
477
+ console.log(tb.quality); // "inauspicious"
447
478
  ```
448
479
 
449
480
  ---
@@ -594,8 +625,16 @@ interface HoraInfo {
594
625
 
595
626
  ```typescript
596
627
  interface SpecialYogaInfo {
597
- name: string; // e.g. "Guru Pushya Yoga"
598
- type: 'amrit_siddhi' | 'sarvartha_siddhi' | 'ravi_pushya' | 'guru_pushya';
628
+ name: string; // e.g. "Guru Pushya Yoga", "Dwipushkar Yoga"
629
+ type:
630
+ | 'amrit_siddhi' | 'sarvartha_siddhi' | 'ravi_pushya' | 'guru_pushya'
631
+ // Phase 28-6 — Vara × Tithi × Nakshatra patterns + Moon-from-Sun distance yogas
632
+ | 'dwipushkar' // Bhadra-tithi + Bhadra-vara + nakshatra ∈ {Mrigashira, Chitra, Dhanishtha} — actions doubled
633
+ | 'tripushkar' // same Bhadra-tithi/vara + nakshatra ∈ {Krittika, Punarvasu, U.Phalguni, Vishakha, U.Ashadha, P.Bhadrapada} — actions tripled
634
+ | 'jwalamukhi' // inauspicious — tithi × nakshatra lookup per Muhurta-chintamani 6.32
635
+ | 'aadal' // auspicious — Moon-from-Sun nakshatra-distance (28-scheme) ∈ {2,7,9,14,16,21,23,28}
636
+ | 'vidaal' // inauspicious — Moon-from-Sun nakshatra-distance (28-scheme) ∈ {3,6,10,13,17,20,24,27}
637
+ | 'ravi'; // auspicious — Moon-from-Sun nakshatra-distance (27-scheme) ∈ {4,6,9,10,13,20}
599
638
  }
600
639
 
601
640
  interface FestivalInfo {
@@ -753,6 +792,15 @@ interface ChandraBalamInfo {
753
792
  englishName: string; // "Shubha" | "Ashubha"
754
793
  name: string; // localized
755
794
  }
795
+
796
+ interface TarabalaInfo {
797
+ taraIndex: number; // 0..8 — position in the 9-tara cycle from janma nakshatra
798
+ englishName: string; // "Janma" | "Sampat" | "Vipat" | "Kshema" | "Pratyari"
799
+ // | "Sadhaka" | "Vadha" | "Mitra" | "Ati-Mitra"
800
+ name: string; // localized
801
+ quality: 'auspicious' | 'inauspicious';
802
+ // 'inauspicious' for Vipat (2) / Pratyari (4) / Vadha (6); rest auspicious
803
+ }
756
804
  ```
757
805
  </details>
758
806
 
@@ -788,10 +836,11 @@ InteractionManager.runAfterInteractions(() => {
788
836
 
789
837
  ## Accuracy
790
838
 
791
- 5,073 tests passing, including fixtures cross-verified against
792
- reference panchang calculations spanning 2025–2026 across Delhi, Chennai,
793
- New York, London, Sydney, Dubai, and Singapore (diaspora fixtures cover
794
- DST transitions on `America/New_York`).
839
+ 6,048 tests passing across 61 files, including fixtures cross-verified
840
+ against reference panchang calculations spanning 2025–2026 across 10
841
+ Indian cities (Phase 28 cross-verify) plus New York, London, Sydney,
842
+ Dubai, and Singapore (diaspora fixtures cover DST transitions on
843
+ `America/New_York`).
795
844
 
796
845
  | Element | Accuracy | Validation |
797
846
  |---------|----------|------------|
@@ -805,6 +854,11 @@ DST transitions on `America/New_York`).
805
854
  | Rashi / Nakshatra / Retrograde flag | Exact match vs reference | Fixtures |
806
855
  | Festival dates | 12 cross-verified festivals (2025–2026) — see caveats below | Fixtures |
807
856
  | Choghadiya / Hora / Gowri slots | Derived from sunrise/sunset — inherits ±2 min | — |
857
+ | Madhyahna midpoint, Anandadi Yoga name, Ganda Mula active flag | **Exact match across 50 Drik fixtures** (10 cities × 5 dates) | [phase28-cross-verify](tests/validation/phase28-cross-verify.test.ts) |
858
+ | Pratah / Sayahna Sandhya start + end | **±2 min vs Drik** across all 50 fixtures | [phase28-cross-verify](tests/validation/phase28-cross-verify.test.ts) |
859
+ | Varjyam start + end | **±2 min vs Drik** on every fixture where the library emits a non-null window (≥30 of 50 emit; transition days return `null` by design) | [phase28-cross-verify](tests/validation/phase28-cross-verify.test.ts) |
860
+
861
+ **Phase 28 sourcing notes** (see [phase28-cross-verify.test.ts](tests/validation/phase28-cross-verify.test.ts) for per-feature findings): **Aadal / Vidaal** follow the classical Moon-from-Sun nakshatra-distance rule (AstroShastra, HoraSarvam, Ernst Wilhelm), NOT the popular Tamil-Vakya weekday rule used by some online panchangs — Drik publishes no algorithmic rule text for these and may use the weekday rule, so the library's output may differ from Drik's Aadal/Vidaal occurrence pages by design. **Varjyam** emits the sunrise-anchored nakshatra's window only (single-window contract per [src/core/varjyam.ts:31-38](src/core/varjyam.ts#L31-L38)) — printed panchangs may show a second window on nakshatra-transition days. **Do Ghati Muhurta** does not rotate by weekday: the same 30-name deity-keyed sequence applies every day, verified against drikpanchang.com/muhurat/daily/do-ghati-muhurat.html for two distinct weekdays. Sourcing is cited inline in [src/core/doGhati.ts:3-21](src/core/doGhati.ts#L3-L21).
808
862
 
809
863
  ### Festival Detection — Documented Tradeoff
810
864