Skip to content
Documentation · all sections

panchang-ts

panchang-ts · v5.0.0 · MIT

Pure TypeScript Hindu Panchang, Jyotish, and birth-chart calculations — offline, zero dependencies, React Native compatible.

panchang-ts computes the Hindu almanac and Vedic astrology from first principles — its own ephemeris, no native modules, no network, no runtime dependencies. One call returns the full daily panchang: the five limbs (tithi, nakshatra, yoga, karana, vara) with intra-day transitions, lunar and solar calendars, muhurtas, inauspicious periods, time-slot systems, special yogas, festivals, and eclipses. Alongside it sits a complete Jyotish layer — birth charts, five dasha systems, compatibility matching, Shadbala, Ashtakavarga, Varshaphala, KP, and Prashna.

A full daily panchang computes in ~0.41 ms (~0.17 ms warm), is typed end to end, and runs identically in Node.js, browsers, and React Native (Hermes). The suite behind it is 8,368 tests across 121 files, cross-verified against reference panchang values — see Accuracy for exactly what that claims.

Install

npm install panchang-ts
# or: pnpm add panchang-ts / yarn add panchang-ts

Quick look

import { getDailyPanchang } from 'panchang-ts';

const result = getDailyPanchang(
  new Date(2025, 0, 14),                      // January 14, 2025
  { latitude: 23.1765, longitude: 75.7885 },  // Ujjain, India
  { timezone: 330 },                          // IST = UTC+5:30 = 330 minutes
);

console.log(result!.angas.tithis[0].name);       // "Krishna Chaturdashi"
console.log(result!.angas.nakshatras[0].name);   // "Mrigashira"
console.log(result!.sun.riseLocal);              // "2025-01-14T07:09:44.172+05:30"
console.log(result!.calendar.samvat.vikramSamvat); // 2081

Start with Getting Started for the two rules that make everything else fall into place: every published Date is a real instant with a *Local display companion, and every field is always present (null or [] when not applicable). Coming from 4.x? The migration guide lists every change.

Features at a glance

CategoryFeatures
Pancha AngaTithi, Nakshatra, Yoga, Karana, Vara — with all intra-day transitions
Lunar calendarChandra Masa (Purnimanta + Amanta), Adhika (leap) detection, Vikram + Shaka Samvat
Solar calendarSaura Masa, Surya Nakshatra, Sankranti (transit-based)
Sun & MoonSunrise, sunset, moonrise, moonset (Meeus apparent-upper-limb), Chandra Rashi
Auspicious muhurtaBrahma, Abhijit, Vijaya, Godhuli, Nishita, Madhyahna, Pratah/Sayahna Sandhya, Amrit Kala
Inauspicious periodsRahu Kalam, Gulika Kalam, Yamaganda, Dur Muhurta, Varjyam, Ganda Mula, Bhadra Kala, Panchaka
Time-slot systemsChoghadiya, Gowri Panchangam, Hora, Do Ghati, Panchaka Rahita
Special yogasAnandadi (28-cycle), Amrit/Sarvartha Siddhi, Ravi/Guru Pushya, Dwi-/Tripushkar, Jwalamukhi, Aadal, Vidaal, Ravi
Festivals (80+)Ekadashi (Smarta/Vaishnava split), Pradosha, Sankranti, classical + regional across 21 states + Nepal
EclipsesSolar/lunar detection, subtype, magnitude, horizon visibility, sutak window
Planetary positionsAll 9 grahas (sidereal) with rashi, nakshatra, pada, retrograde — mean or true Rahu/Ketu
DashasVimshottari (3-level), Ashtottari, Yogini, Chara, Narayan
Personal transitsChandra Balam, Tarabala (9-cycle), Sade Sati
Birth chartLagna, Bhava under 3 house systems, D1/D2/D3/D7/D9/D10/D12/D30, planetary dignity
Compatibility & doshasAshtakoot (36-point), Pathu Porutham, Mangal, Kaal Sarp (12 subtypes), Pitru
Strength & aspectsDrishti, Shadbala, Ashtakavarga (with reductions), Bhava Bala, Argala
Yogas & karakas25 named yogas (with cancellations), 7- and 8-karaka Jaimini
Annual & sensitiveVarshaphala (Tajik + 27 Sahams), Tithi Pravesha, Arudha padas, special lagnas, Upagrahas
KP & PrashnaKP sub-lord at any longitude, Placidus-KP cuspal sub-lords, significators, Prashna chart
Muhurta engineConfigurable scoring + 13 stock occasions (vivah, griha pravesh, namakarana, …)
Calendar conversionGregorian ↔ Hindu, Kali Yuga year, Hindu New Year, yearly Ekadashi/Sankranti/festival listings
LocalizationEnglish + Hindi (Devanagari)
Configuration5 ayanamsas, 2 masa systems, 3 house systems

Browse the docs

Getting Started

Install panchang-ts, compute your first daily panchang, and learn how to read the times and grouped result it returns.

Upgrading from 4.x

Every breaking change in v5: real Date instants, the grouped result, the corrected Lahiri ayanamsa, measured ΔT, and the read*/compute* naming convention.

Daily Panchang

getDailyPanchang and getInstantPanchang in full: every option, and all seven result groups — angas, calendar, sun, moon, muhurtas, inauspicious periods, and time-slot systems.

Festivals

80+ festivals with stable keys, Smarta/Vaishnava Ekadashi handling, regional scoping across 21 states + Nepal, and the cacheable pre-computed festivals table.

Eclipses & Moon Phases

Solar and lunar eclipse detection with sutak windows, upcoming-eclipse search, precise lunar phase instants, and their engine-free table readers.

Muhurta Engine

Score any date against 13 stock occasions or your own rule, understand the scoring model and Vara × Tithi yogas, and ship pre-computed muhurta tables.

Calendar Conversion

Gregorian ↔ Hindu date conversion, Kali Yuga year, region-aware Hindu New Year, and yearly Ekadashi / Sankranti / festival listings.

Birth Charts

Planetary positions, Lagna, Bhava under three house systems, D1 and six divisional charts, and planetary dignity.

Dashas & Transits

Vimshottari (3-level), Ashtottari, Yogini, Chara, and Narayan dashas, plus the daily transits — Chandra Balam, Tarabala, and Sade Sati.

Strength, Yogas & Karakas

Graha drishti, six-fold Shadbala, Bhava Bala, Ashtakavarga with reductions, ~25 named yogas with cancellations, and Jaimini karakas.

Matching & Doshas

Ashtakoot 36-point matching, Tamil Pathu Porutham, pairwise Mangal dosha verdicts, Kaal Sarp subtypes, and Pitru dosha.

Annual Charts & Sensitive Points

Varshaphala with 27 Sahams, Tithi Pravesha, Arudha padas, Hora/Ghati/Bhava/Sripati lagnas, Upagrahas, and Argala.

KP & Prashna

KP sub-lords at any longitude, Placidus-KP cuspal sub-lords, four-fold significators, and horary Prashna charts.

Options & Localization

Every option accepted by the entry points, English/Hindi localization, timezone handling, and the localized vs machine-readable field convention.

Types & Exports

The key result interfaces and the complete export list of the package and its four engine-free subpath entries.

Performance

Measured costs, the sections and computeEndTimes levers, process-wide caches, and the React Native / Hermes rendering pattern.

Accuracy

What the 8,368-test suite verifies against reference panchangs, end-time drift bounds, ayanamsa provenance, and documented festival-dating tradeoffs.

Errors & Compatibility

PanchangError codes, polar-latitude behavior, and the supported runtimes — Node, browsers, React Native (Hermes), and Expo.

Used by

dharmagya.app — this site: daily panchang, Hindu calendar, and every Jyotish calculator on it — and the Dharmagya Android app.