npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jyotish-calc

v1.3.3

Published

Comprehensive Vedic Astrology library with precise Panchanga, Special Lagnas, Upagrahas, Ashtakavarga, Dashas, Vargas, Shadbala, Doshas, and Yogas

Readme

Jyotish Calculations

A comprehensive JavaScript library for Vedic Astrology (Jyotish) calculations and interpretations.

Overview

This package provides tools and utilities for performing various Vedic Astrology calculations, including planetary positions, nakshatras (lunar mansions), rashis (zodiac signs), special lagnas (Bhava, Hora, Ghati, etc.), upagrahas (Gulika, Mandi, Dhuma, etc.), Ashtakavarga (BAV & SAV), planetary periods (dashas), divisional charts (vargas), and planetary strengths (shadbala). It leverages the Swiss Ephemeris for precise astronomical calculations.

Installation

npm install jyotish-calc

Features

  • Graha Calculations: Calculate positions and aspects of the nine planets (grahas)
  • Panchanga: Complete Vedic calendar with tithi, nakshatra, yoga, karana, vaara, muhurtas
  • Special Lagnas: Calculate Bhava Lagna, Hora Lagna, Ghati Lagna, etc.
  • Upagrahas: Calculate shadow planets like Gulika, Mandi, Dhuma, etc.
  • Ashtakavarga: Complete BAV and SAV calculations with house strength analysis
  • Dasha Systems: Full support for 7 dasha systems (Vimshottari, Ashtottari, Yogini, etc.) with 5-level sub-periods
  • Divisional Charts (Vargas): Precise calculations for all 21 divisional charts (D1-D60) with no redundant D1 data
  • Shadbala & Bhavabala: Comprehensive 6-fold planetary strength and house strength calculations
  • Dosha Calculations: Analysis of 8 major doshas including Kala Sarpa, Manglik (with 17 exception rules), Pitru Dosha, etc.
  • Yoga & Raja Yoga: Detection of 53 types of Yogas (Pancha Mahapurusha, etc.) and comprehensive Raja Yoga pair analysis.

Project Structure

jyotish
├── index.js            # Main entry point
├── package.json        # Package configuration
└── src
   ├── panchanga        # Panchanga (Vedic calendar/almanac)
   ├── ashtakavarga     # Ashtakavarga (BAV & SAV) calculations
   ├── lagnas           # Special Lagna calculations
   ├── upagrahas        # Upagraha calculations
   ├── bhavas           # House calculations
   ├── dashas           # Dasha periods (Vimshottari, Jaimini, etc.)
   ├── grahas           # Planetary calculations
   ├── nakshatras       # Lunar mansion calculations
   ├── rashis           # Zodiac sign calculations
   ├── strengths        # Shadbala and Bhavabala
   ├── vargas           # Divisional charts (D1-D60)
   ├── doshas           # Manglik, Kala Sarpa, and other doshas
   ├── rajayogas        # Raja Yoga pair detection
   ├── yogas            # 50+ common yogas (Pancha Mahapurusha, etc.)
   └── utils            # Helper utilities

Usage

Basic Planetary Positions

const jyotish = require('jyotish-calc');

const date = new Date('1990-01-01T12:00:00Z');
const location = {
  latitude: 28.6139,  // Delhi, India
  longitude: 77.2090,
  altitude: 0
};

// Calculate planet positions
const planetPositions = jyotish.grahas.calculatePositions(date, location);
console.log(planetPositions);

Dasha Calculations

Calculate planetary periods for any of the 7 supported systems (Vimshottari, Ashtottari, Yogini, Kalachakra, Chara, Sthira, Narayana).

const { dashas } = require('jyotish-calc');

const moonLongitude = 280.5; // Capricorn 10.5 degrees
const birthDate = '1990-01-01';

// Calculate Vimshottari Dasha
const vimshottari = dashas.getDashas(moonLongitude, 'Vimshottari', birthDate);
console.log(vimshottari);

// Get dashas running on a specific date
const currentDasha = dashas.getDashasForDate(moonLongitude, 'Vimshottari', birthDate, '2025-01-01');
/* Output:
{
  mahadasha: { lord: 'Jupiter', end: '2026-05-12' },
  antardasha: { lord: 'Saturn', end: '2024-11-20' },
  pratyantardasha: { lord: 'Mercury', end: '2025-03-25' },
  ...
}
*/

Divisional Charts (Vargas)

Calculate any of the 21 standard divisional charts (D1, D2, D3, D4, D7, D9, D10, D12, D16, D20, D24, D27, D30, D40, D45, D60).

const { vargas } = require('jyotish-calc');

const sunLongitude = 45.5; // Taurus 15.5 degrees

// Calculate single varga (e.g. Navamsha D9)
const navamsha = vargas.calculateVarga(sunLongitude, 'D9');
console.log(navamsha.sign); // "Taurus"

// Calculate full varga chart for all planets
const planetLongitudes = { Sun: 45.5, Moon: 120.3, /* ... */ };
const navamshaChart = vargas.calculateVargaChart(planetLongitudes, 'D9');

Shadbala & Bhavabala (Strengths)

Calculate the comprehensive six-fold strength (Shadbala) of planets and house strengths (Bhavabala).

const { strengths } = require('jyotish-calc');

// Planet positions: [[signIndex, degree], ...] for Sun(0) to Saturn(6)
// Sign Index: 0=Aries, 1=Taurus, ... 11=Pisces
const positions = [
    [0, 15],   // Sun in Aries 15°
    [1, 20],   // Moon in Taurus 20°
    // ... Mars, Mercury, Jupiter, Venus, Saturn
];
const ascendant = 0; // Aries
const jd = 2451545; // Julian Day Number

// Calculate complete Shadbala
const result = strengths.calculateShadbala(positions, ascendant, jd, 28.6, 77.2);

console.log(result.strength); // Array of relative strength ratios (1.0 = minimum requirement)
console.log(result.total);    // Array of total virupas (points)

// Calculate House Strengths (Bhavabala)
const bhavaStrength = strengths.calculateBhavaBala(positions, ascendant, jd, 28.6, 77.2);
console.log(bhavaStrength.total);

Special Lagnas & Upagrahas

Calculate special rising signs and shadow planets for all divisional charts.

const { lagnas, upagrahas, vargas, grahas } = require('jyotish-calc');

const birthData = {
    year: 1998, month: 9, date: 11,
    hour: 4, min: 30, sec: 0,
    lat: 13.0827, lng: 80.2707,
    timezone: 5.5
};

// Calculate all special points
const specialLagnas = lagnas.calculateAllSpecialLagnas(birthData);
const positions = grahas.getGrahasPosition(birthData);
const shadowPlanets = upagrahas.calculateAllUpagrahas(birthData, positions);

// Integrate with divisional charts
const allPoints = {
    Sun: positions.Su.longitude,
    Ascendant: positions.La.longitude,
    ...specialLagnas,
    ...shadowPlanets
};
const d9Chart = vargas.calculateVargaChart(allPoints, 'D9');

Panchanga (Vedic Calendar)

Complete Vedic almanac with all 5 elements, muhurtas, and calendar functions.

const { panchanga } = require('jyotish-calc');

const panchangaData = panchanga.calculatePanchanga({
    year: 1998, month: 9, date: 11,
    hour: 4, min: 30, sec: 0,
    lat: 13.0827, lng: 80.2707, timezone: 5.5
});

console.log(panchangaData.sunrise);   // {time: 5.97, string: "05:57:55 AM"}
console.log(panchangaData.tithi);     // {number: 21, name: "Shashthi", paksha: "Krishna"}
console.log(panchangaData.nakshatra); // {number: 2, name: "Bharani", pada: 4}
console.log(panchangaData.yoga);      // {number: 13, name: "Vyaghata"}
console.log(panchangaData.vaara);     // {name: "Friday", nameSanskrit: "Shukravara"}
console.log(panchangaData.muhurtas.raahuKaalam); // {start: "10:34 AM", end: "12:05 PM"}

Ashtakavarga

Complete strength assessment system.

const { ashtakavarga } = require('jyotish-calc');

const positions = {
    Sun: 144.188,
    Moon: 26.174,
    Mars: 109.654,
    Mercury: 131.142,
    Jupiter: 329.905,
    Venus: 131.297,
    Saturn: 9.205,
    Ascendant: 122.003
};

// Calculate BAV and SAV
const results = ashtakavarga.calculateAshtakavarga(positions);

console.log(results.sav); // [27, 33, 40, 23, 26, 25, 27, 26, 29, 34, 27, 20]
console.log(results.interpretations.houses[2]); // "Exceptional" (40 bindus)

// Kakshya Analysis
const kakshya = ashtakavarga.getKakshya(145.5);
console.log(kakshya.ruler); // "Mars"

Doshas, Yogas & Raja Yogas

Analyze charts for major doshas (afflictions) and auspicious yogas (combinations).

const { doshas, yogas, rajayogas } = require('jyotish-calc');

// Sample planet positions: [[planetIndex, [signIndex, degree]], ...]
const planetPositions = [
    [0, [3, 15]], // Sun in Cancer
    [1, [0, 10]], // Moon in Aries
    [2, [6, 20]], // Mars in Libra
    // ...
    ['L', [0, 15]] // Lagna in Aries
];

// 1. Comprehensive Dosha Analysis
const doshaResults = doshas.getDoshaDetails(planetPositions);
console.log(doshaResults.manglik.hasDosha);   // true/false
console.log(doshaResults.kalaSarpa.type);     // "Anant", "Vasuki", etc.

// 2. Yoga Detection (53 types supported)
const yogaResults = yogas.getYogaDetails(planetPositions);
console.log(yogaResults.summary.present);     // ["hamsa", "vesi", "gajaKesari", ...]
console.log(yogaResults.moonYogas.adhi);      // true/false

// 3. Raja Yoga Analysis (Quadrant/Trine lord associations)
const rajaYogaResults = rajayogas.getRajaYogaDetails(planetPositions);
console.log(rajaYogaResults.summary.totalPairs);
console.log(rajaYogaResults.summary.hasNeechaBhanga); // true/false

Dependencies

  • swisseph-v2: v1.0.4 - Swiss Ephemeris library for astronomical calculations

License

ISC