Packages2 MIN READ90 / 116

Internal module guide. This module is now part of @astrology/vedic; use the public package README for application setup.

panchang module

Sunrise-anchored five limbs of the panchang, the Vedic calendar day, with solved boundary instants. Public imports use the package root. See the package specification and task plan (V-08).

Run pnpm --filter @astrology/vedic build, check, and test after building dependencies (pnpm build:vedic builds all).

Rise/set gate

calculatePanchang(request, probePort, rules) needs a rise/set answer. Composer declares riseSet as optional; the native Binder reader now supplies Hindu events. Without a connected port the call fails with LAYER_UNSUPPORTED and { gate: 'rise-set' }; there is no midnight fallback. A missing sunrise or next sunrise fails; a missing sunset is null.

Limbs

The day is [sunrise, nextSunrise) and vara is the weekday of the host-supplied local date label. Tithi (lunar day, each 12° of Sun–Moon separation) and karana (half a tithi) use Sun–Moon elongation (invariant under the ayanamsa, the tropical–sidereal offset), yoga the sidereal sum, nakshatra the Moon with Binder’s id as authority. Every interval overlapping the day is returned whole, with kshaya/adhika flags on tithis. solveBoundary brackets each crossing, uses Newton steps on returned speed (a secant when speed is null, with periodic bisection) and stops within the rulebook tolerance (1 s); exhausting the per-boundary probe budget is LIMIT_EXCEEDED. includeMoonSigns adds Moon sign intervals, which muhurta needs for panchaka (prerequisite P2). PANCHANG_RULES holds canonical limb ids, the 60-karana cycle and the search policy.