- Dharmagya
- panchang-ts docs
- Types & Exports
Types & Exports
panchang-ts · v5.0.0 · MIT
The key result interfaces and the complete export list of the package and its four engine-free subpath entries.
Everything importable from panchang-ts is a semver-stable contract; anything not exported is internal and may change in any release. This page shows the shapes you will hold most often, then the complete export list.
Core, Pancha Anga, festivals
interface GeoLocation { latitude: number; longitude: number; elevation?: number; }
interface TimePeriod { start: Date; end: Date; } // + startLocal / endLocal strings
interface TithiInfo {
index: number; // 0-29
name: string;
paksha: string; // "Shukla"/"Krishna" (en), "शुक्ल"/"कृष्ण" (hi)
number: number; // 1-15 within the paksha
completionPercentage: number;
endTime: Date | null;
}
// NakshatraInfo, YogaInfo, KaranaInfo follow the same pattern.
// DailyTithiInfo extends with startTime + isActiveAtSunrise.
interface VaraInfo {
index: number; // 0 = Sunday … 6 = Saturday
name: string; // localized (e.g. "Raviwara")
shortName: string;
englishName: string; // always English
}
interface FestivalInfo {
key: string; // stable, language-independent id — match on this
name: string; // localized — display only
type: 'major' | 'minor' | 'ekadashi' | 'smarta_ekadashi' | 'vaishnava_ekadashi'
| 'pradosha' | 'sankranti' | 'eclipse';
description?: string;
deferralDate?: Date; // Smarta Ekadashi → Dwadashi fast date
}
type FestivalRegion =
| 'all'
| 'tamil-nadu' | 'kerala' | 'karnataka' | 'andhra-pradesh' | 'telangana'
| 'west-bengal' | 'odisha' | 'assam' | 'bihar' | 'jharkhand'
| 'gujarat' | 'maharashtra' | 'goa' | 'rajasthan'
| 'punjab' | 'haryana' | 'himachal-pradesh' | 'uttarakhand'
| 'uttar-pradesh' | 'madhya-pradesh'
| 'nepal';
// Legacy slugs accepted (mapped internally): 'tamil' → 'tamil-nadu',
// 'bengal' → 'west-bengal', 'north-india' → 'all'.Eclipses & Bhadra
interface EclipseInfo {
kind: 'solar' | 'lunar';
subtype: 'partial' | 'total' | 'annular' | 'penumbral';
start: Date; peak: Date; end: Date;
visibleFromLocation: boolean;
obscuration: number; // disc AREA covered at peak, [0, 1]
magnitude: number; // catalogue magnitude — disc DIAMETER covered.
// Not [0, 1]: >1 for a total eclipse, negative
// for a penumbral lunar one.
sutakStart: Date; // 12 h pre-solar / 9 h pre-lunar
sutakEnd: Date;
description: string;
}
interface BhadraInfo {
start: Date; end: Date;
location: 'earth' | 'heaven' | 'paatal'; // 'earth' = malefic for all work
locationName: string; // localized display name
isActive: boolean;
}Jyotish
type GrahaName = 'Sun' | 'Moon' | 'Mars' | 'Mercury' | 'Jupiter'
| 'Venus' | 'Saturn' | 'Rahu' | 'Ketu';
interface GrahaPosition {
planet: GrahaName;
siderealLongitude: number;
rashi: RashiInfo;
degreeInRashi: number;
nakshatra: NakshatraInfo;
isRetrograde: boolean; // always false for Sun/Moon; always true for Rahu/Ketu
}
type DashaLord = 'Ketu' | 'Venus' | 'Sun' | 'Moon' | 'Mars'
| 'Rahu' | 'Jupiter' | 'Saturn' | 'Mercury';
interface MahaDasha { lord: DashaLord; startDate: Date; endDate: Date;
years: number; antarDashas: AntarDasha[]; }
interface VimshottariDashaResult {
currentMahaDashaLord: DashaLord;
currentIndex: number;
mahaDashas: MahaDasha[];
}
interface ChandraBalamInfo {
house: number; // 1 = janma rashi; 12 = rashi before janma
quality: 'strong' | 'weak'; // Shubha houses = 1,3,6,7,10,11
englishName: string; // "Shubha" | "Ashubha"
name: string;
}
interface TarabalaInfo {
taraIndex: number; // 0..8 in 9-tara cycle from janma nakshatra
englishName: string; // Janma | Sampat | Vipat | Kshema | Pratyari
// | Sadhaka | Vadha | Mitra | Ati-Mitra
name: string;
quality: 'auspicious' | 'inauspicious';
}Full export list
// Primary entry points
getDailyPanchang, getInstantPanchang
// Astronomy
getSunrise, getSunset, getMoonrise, getMoonset
getSiderealSunLongitude, getSiderealMoonLongitude, getAyanamsa
formatInZone
// Inauspicious / Muhurta
computeRahuKalam, computeGulikaKalam, computeYamaganda
computeVarjyam, computeGandaMula, computeAnandadiYoga
computePanchakaRahita, computeDoGhati, computeGowriPanchangam
computePanchaka, classifyPanchaka, isPanchakaDosha, findPanchakaOnset
computeAbhijitMuhurta, computeBrahmaMuhurta, computeVijayaMuhurta
computeGodhuliMuhurta, computeNishitaMuhurta, computeAmritKala
computeMadhyahna, computePratahSandhya, computeSayahnaSandhya
// Eclipses
getUpcomingSolarEclipse, getUpcomingLunarEclipse, getEclipseDuringDay
isEclipseVisibleAnyPhase
// Moon phases (new / quarters / full as precise instants)
computeMoonPhasesInRange, computeMoonPhasesForYear
// Jyotish — planets, dashas, transits
computePlanetaryPositions, GRAHA_ABBR
computeVimshottariDasha, computeVimshottariDashaFromBirth, computeVimshottariPratyantar
computeAshtottariDasha, computeYoginiDasha, computeCharaDasha, computeNarayanDasha
computeChandraBalam, computeTarabala, computeSadeSati
// Jyotish — chart
computeLagna, computeBhava, computeRashiChart, computeNavamsa, computeDivisionalChart
computeHoraLagna, computeGhatiLagna, computeBhavaLagna, computeSripatiLagna
computeDignity
// Jyotish — strength, yogas, sensitive
computeAspects, computeShadbala, computeBhavaBala, computeAshtakavarga
computeYogas, computeJaiminiKarakas
computeVarshaphala, computeTithiPravesha, computeArudhas, computeUpagrahas, computeArgala
// Jyotish — compatibility, doshas
computeAshtakoot, computePathuPorutham
computeMangalDosha, computeMangalCompatibility, computeKaalSarp, computePitruDosha
// KP / Prashna
computeKpSubLord, computeKpCuspalSubLords, computeKpSignificators
computePrashnaChart
// Muhurta engine
scoreMuhurta, computeAuspiciousDatesInRange, computeAuspiciousDatesForYear
computeVaraTithiYogas, STOCK_MUHURTA_RULES
vivahRule, grihaPraveshRule, namakaranaRule, vidyarambhRule, vahanKharidiRule
annaprashanRule, mundanRule, upanayanamRule, karnavedhaRule
aksharabhyasamRule, seemanthamRule, shopOpeningRule, travelStartRule
// Calendar conversion + yearly listings
convertGregorianToHindu, convertHinduToGregorian
getKaliYugaYear, getHinduNewYear, computeSamvat
computeEkadashiDatesForYear, computeSankrantisForYear
computeFestivalsInRange, computeFestivalsForYear
computeEclipsesInRange, computeEclipsesForYear, getUpcomingEclipses
// Static data tables — build one, cache the JSON, then read it back through
// the engine-free subpath entries. No table ships with the package.
buildFestivalsTable, buildEclipsesTable, buildMoonPhasesTable, buildMuhurtaTable
// Errors
PanchangErrorSubpath entry points
// Engine-free table readers (no astronomy code in your bundle):
import { readFestivalsForYear, readFestivalsForDate, readFestivalsYearRange }
from 'panchang-ts/festivals';
import { readEclipsesForYear, readEclipsesForDate, readEclipsesYearRange }
from 'panchang-ts/eclipses';
import { readMoonPhasesForYear, readMoonPhasesForDate, readMoonPhasesYearRange }
from 'panchang-ts/moon-phases';
import { readMuhurtaForYear, readMuhurtaForDate, readMuhurtaYearRange,
readMuhurtaOccasion, readBestMuhurtaDays }
from 'panchang-ts/muhurta';Table file/entry types (FestivalsFile, EclipsesFile, MoonPhasesFile, MuhurtaFile, and their *TableDay / *TableEntry shapes) are exported from the main entry for typing persisted JSON.
