panchang
panchang · v5.4.0 · MIT
Hindu Panchang, Jyotish and birth-chart calculations for TypeScript and Go. Works offline, has no dependencies, and runs the same in both languages.
panchang works out the Hindu almanac and Vedic astrology. It carries its own ephemeris, so it has no runtime dependencies and makes no network call. One call gives you the whole day: the five limbs with their intra-day changes, both calendars, muhurtas, inauspicious periods, time-slot systems, special yogas, festivals and eclipses. A full Jyotish layer sits next to it, covering birth charts, dashas, compatibility matching, strength, Varshaphala, KP and Prashna.
It ships for TypeScript and Go. Both are built from the same rules and give the same answers. Every example on this site is shown in both languages. Use the switcher above any code block and the whole site follows your choice.
The TypeScript build runs in Node, browsers and React Native (Hermes), and computes a full day in about 0.30 ms (0.10 ms warm). The test suite checks it against a reference almanac — Accuracy says exactly what that covers.
Install
npm install panchang-ts
# or: pnpm add panchang-ts / yarn add panchang-tsgo get github.com/ishankgupta95/panchang/source/go/v5Quick look
import { getDailyPanchang } from 'panchang-ts';
const result = getDailyPanchang(
new Date('2025-01-14T00:00:00Z'), // January 14, 2025 (05:30 IST)
{ latitude: 23.1765, longitude: 75.7885 }, // Ujjain, India
{ timezone: 330 }, // IST = UTC+5:30 = 330 minutes
);
console.log(result!.angas.tithis[0].name); // "Krishna Pratipada"
console.log(result!.angas.nakshatras[0].name); // "Punarvasu"
console.log(result!.sun.riseLocal); // "2025-01-14T07:10:16.566+05:30"
console.log(result!.calendar.samvat.vikramSamvat); // 2081package main
import (
"fmt"
"time"
"github.com/ishankgupta95/panchang/source/go/v5/panchang"
"github.com/ishankgupta95/panchang/source/go/v5/types"
)
func main() {
s := panchang.New()
day, ok, err := s.GetDailyPanchang(
time.Date(2025, 1, 14, 0, 0, 0, 0, time.UTC),
types.GeoLocation{Latitude: 23.1765, Longitude: 75.7885}, // Ujjain, India
types.PanchangOptions{Timezone: panchang.OffsetMinutes(330)}, // IST = UTC+5:30
)
if err != nil {
panic(err) // bad input: a *types.PanchangError with a stable Code
}
if !ok {
return // no Hindu day starts on this date (polar latitudes, or an offset far from local solar time); not an error
}
fmt.Println(day.Angas.Tithis[0].Name) // Krishna Pratipada
fmt.Println(day.Angas.Nakshatras[0].Name) // Punarvasu
fmt.Println(day.Sun.RiseLocal) // 2025-01-14T07:10:16.566+05:30
fmt.Println(day.Calendar.Samvat.VikramSamvat) // 2081
}Getting Started covers the two rules that shape every result: each time is a real instant with a *Local string for display, and every field is always there (null or [] when it does not apply).
Coming from an older version? Apply the guides oldest first: 4.x → 5, then 5.0 → 5.1, then 5.1 → 5.2, then 5.2 → 5.3, then 5.3 → 5.4.
Features at a glance
| Category | Features |
|---|---|
| Pancha Anga | Tithi, Nakshatra, Yoga, Karana, Vara, with every intra-day change |
| Lunar calendar | Chandra Masa (Purnimanta and Amanta), Adhika months, Vikram and Shaka Samvat |
| Solar calendar | Saura Masa, Surya Nakshatra, Sankranti |
| Sun & Moon | Sunrise, sunset, moonrise, moonset, Chandra Rashi |
| Auspicious muhurta | Brahma, Abhijit, Vijaya, Godhuli, Nishita, Madhyahna, Pratah and Sayahna Sandhya, Amrit Kala |
| Inauspicious periods | Rahu Kalam, Gulika Kalam, Yamaganda, Dur Muhurta, Varjyam, Ganda Mula, Bhadra Kala, Panchaka |
| Time-slot systems | Choghadiya, Gowri Panchangam, Hora, Do Ghati, Panchaka Rahita |
| Special yogas | Anandadi, Amrit and Sarvartha Siddhi, Ravi and Guru Pushya, Dwi- and Tripushkar, Jwalamukhi, Aadal, Vidaal, Ravi |
| Festivals (80+) | Ekadashi (Smarta and Vaishnava), Pradosha, Sankranti, classical and regional across 20 states and Nepal |
| Eclipses | Solar and lunar, with subtype, magnitude, visibility and sutak window |
| Planetary positions | All 9 grahas with rashi, nakshatra, pada and retrograde; mean or true Rahu/Ketu |
| Dashas | Vimshottari (3-level), Ashtottari, Yogini, Chara, Narayan |
| Personal transits | Chandra Balam, Tarabala, Sade Sati |
| Birth chart | Lagna, Bhava in 3 house systems, D1/D2/D3/D7/D9/D10/D12/D30, dignity |
| Compatibility & doshas | Ashtakoot (36-point), Pathu Porutham, Mangal, Kaal Sarp, Pitru |
| Strength & aspects | Drishti, Shadbala, Ashtakavarga, Bhava Bala, Argala |
| Yogas & karakas | 25 named yogas with cancellations, 7- and 8-karaka Jaimini |
| Annual & sensitive | Varshaphala (Tajik, 27 Sahams), Tithi Pravesha, Arudha padas, special lagnas, Upagrahas |
| KP & Prashna | Sub-lord at any longitude, cuspal sub-lords, significators, Prashna chart |
| Muhurta engine | Your own scoring rules, plus 13 stock occasions (vivah, griha pravesh, namakarana, …) |
| Calendar conversion | Gregorian ↔ Hindu, Kali Yuga year, Hindu New Year, yearly festival listings |
| Localization | English + Hindi (Devanagari) |
| Configuration | 5 ayanamsas, 2 masa systems, 3 house systems |
Browse the docs
Getting Started
Install the package, compute your first daily panchang, and read the times it gives you back. Every example is shown in TypeScript and Go.
Upgrading 5.3 → 5.4
No signature changes and nothing removed, but many values move: festival days that follow the reference almanac, the new holika_dahan and karthigai_deepam keys, the five-level Yoni koota, the new Brahma Muhurta window, day values west of UTC and the Odisha new year. Plus one new call, computeVimshottariPratyantarIn.
Upgrading 5.2 → 5.3
A version bump for TypeScript and nothing else. For Go: the new types package and the aliases that keep old code compiling, the Context twins on the range-walking calls, the enum helpers, and a way to match an error code.
Upgrading 5.1 → 5.2
No type breaks and no removed exports — the festivals that used to vanish for a whole year, the three that move date, the de-duplicated eclipse ranges, and the new reference frames and asOfDate parameter.
Upgrading 5.0 → 5.1
The three fields that became arrays (varjyam, durMuhurta, amritKala), the corrected Yogini and Ashtottari starting lords, the Ekadashi split and regional new-year moves, and opt-in Gana-dosha cancellation.
Upgrading 4.x → 5
Real Date instants and their *Local companions, the grouped result object, 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 20 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 seven 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 getDailyPanchang, English/Hindi localization, timezone handling, and the localized vs machine-readable field convention.
Types & Exports
The main result shapes, how you name them in TypeScript and in Go, and the full list of what the package exports.
Performance
What a call costs, how to make it cheaper with sections and computeEndTimes, and how the caches behave. Timings are from the TypeScript build; Go appears as 5.4 speedup ratios.
Accuracy
What the test suite verifies against the reference almanac, end-time drift bounds, ayanamsa provenance, and documented festival-dating tradeoffs.
Errors & Compatibility
The error codes both languages share, what happens at polar latitudes, and where the library runs — Node, browsers, React Native, Expo and Go.
Used by
dharmagya.app runs on it: the daily panchang, the Hindu calendar and every Jyotish calculator on this site. So does the Dharmagya Android app.
