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

vpv-panchangam

v1.0.0

Published

Vedic Panchanga and Kundali calculator for Node.js

Readme

vpv-panchangam

A complete Vedic Panchanga and Kundali (birth chart) calculator for Node.js and browsers, written in TypeScript. Uses the Swiss Ephemeris via @swisseph/browser (WebAssembly) for astronomical calculations and pure TypeScript for all astrological logic.

Try the live interactive demo: https://reflexdemon.github.io/vpv-panchangam/

Features

  • Full Drik Panchang: Tithi, Nakshatra, Yoga, Karana, Vara, Moon sign, Sun sign
  • Auspicious timings: Brahma Muhurta, Abhijit, Vijay, Godhuli, Nishita, Amrit Kalam, Sarvartha/Amrita Siddhi Yoga
  • Inauspicious timings: Rahu Kalam, Yamaganda, Gulika, Dur Muhurtam, Bhadra, Varjyam
  • Gowri Panchangam (8+8 segments) and Planetary Hora (12+12)
  • Nalla Neram (auspicious hours after subtracting inauspicious windows)
  • Tyajyam: all 10 types (Nakshatra, Tithi, Vara, Amritadi, Lagna, Karana, Gowri, Dosha, Tithi-Lagna, Tamil Month)
  • Calendars: Shaka, Vikram, Kali, Gujarati, National Civil, Nirayana solar, Lunar month
  • Ritu/Ayana, Chandra Vasa, Disha Shool, Rahu Vasa
  • Birth Chart (Kundali): All 17 divisional charts (D1–D60), including D11 Rudramsa
  • Vimshottari Dasha: Mahadasha + Antardasha + Pratyantar
  • Ashtakavarga: BAV + SAV for all 7 planets
  • Special placements: Exaltation, debilitation, own sign, Moolatrikona, Vargottama, Digbala, Pushkara, Mrityu Bhaga, Gandanta, Neecha Bhanga, Parivartana, Graha Yuddha
  • Jaimini Chara Karakas + Karakamsa/Swamsa
  • Planetary friendships (natural, temporal, composite)
  • Graha Drishti (aspects with strength)
  • Kalsarpa Yoga detection
  • Locales: English (en), Hindi/Devanagari (hi), Tamil (ta)

Requirements

  • Node.js 20+ (Node only; browsers are also supported)

Installation

npm install vpv-panchangam

The astronomical engine ships as a WebAssembly module inside @swisseph/browser; no native C++ build step is required. In browsers the engine is loaded automatically; in Node.js a small fetch shim is installed on first use to serve the bundled .wasm.

Browser and CDN usage

The npm entry point is CommonJS and it lazily import()s the ESM-only @swisseph/browser package, so a CDN cannot load the package by name — a bare specifier like https://cdn.jsdelivr.net/npm/vpv-panchangam will not resolve, and the Swiss Ephemeris WebAssembly is a sidecar file that must sit next to the module loading it.

That is what dist/browser/ is for: a pre-bundled ESM module with swisseph.wasm beside it, both served straight from npm.

npm (Node.js and bundlers)

npm install vpv-panchangam
import { computeDetailedPanchang } from 'vpv-panchangam';

CDN — no build step

import { computeDetailedPanchang } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/vpv-panchangam.mjs';

On unpkg instead:

import { computeDetailedPanchang } from 'https://unpkg.com/[email protected]/dist/browser/vpv-panchangam.mjs';

CDN — plain script tag

Paste into your HTML; it exposes window.vpv.

<script type="module">
  import * as vpv from "https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/vpv-panchangam.mjs";

  window.vpv = vpv;
</script>
const p = await window.vpv.computeDetailedPanchang('2026-09-28', 23.1765, 75.7885, 'Asia/Kolkata', 'en');

The swisseph.wasm sidecar wants an application/wasm MIME type. Hosts that serve it as application/octet-stream — which jsDelivr and unpkg commonly do — still load the module fine, but Emscripten logs a MIME warning and falls back to ArrayBuffer instantiation instead of instantiateStreaming. Harmless.

Pin the exact version. The URL hardcodes the dist/browser/ path, so a range like @0.4 or @latest will break the moment a release moves that file.

Try it all live at https://reflexdemon.github.io/vpv-panchangam/.

Quick Start

Panchang (Daily Almanac)

import { computeDetailedPanchang } from 'vpv-panchangam';

const panchang = await computeDetailedPanchang(
  '2026-07-04',       // date (YYYY-MM-DD), defaults to today
  34.075,             // latitude
  -84.294,            // longitude
  'America/New_York', // IANA timezone (defaults to 'UTC')
  'en',               // locale: 'en' | 'hi' | 'ta'
);

console.log(panchang.vara.english);           // "Saturday"
console.log(panchang.panchang.tithi?.name);   // e.g. "Ashtami"
console.log(panchang.sun_moon.sunrise);       // ISO datetime string
console.log(panchang.auspicious_timings.abhijit);
// { start: "2026-07-04T17:23:00.000Z", end: "2026-07-04T18:11:00.000Z" }

Birth Chart (Kundali)

import { computeChart } from 'vpv-panchangam';

const chart = await computeChart(
  {
    date:      '1990-03-15',
    time:      '08:30',          // 24-hour local time
    latitude:  28.6139,
    longitude: 77.2090,
    timezone:  'Asia/Kolkata',
    ayanamsa:  'lahiri',         // default
  },
  'en',  // locale
);

console.log(chart.ascendant.sign);             // "Aries"
console.log(chart.planets_data[0].name);       // "Sun"
console.log(chart.dasha[0].lord);              // Current Mahadasha lord
console.log(chart.d9_chart.asc_sign);          // D9 ascendant sign id (1-12)
console.log(chart.kalsarpa.present);           // true/false
console.log(chart.ashtakavarga.sav);           // [12 SAV totals per sign]

Hindi / Tamil output

const panchang = await computeDetailedPanchang(
  '2026-07-04', 13.083, 80.270, 'Asia/Kolkata', 'ta'
);
console.log(panchang.vara.sanskrit);           // "சனிவாரம்"
console.log(panchang.panchang.nakshatra?.name); // Tamil nakshatra name

API Reference

computeDetailedPanchang(date?, latitude, longitude, timezone?, locale?)

Returns a Promise<PanchangResponse>. All time strings are UTC ISO-8601.

| Parameter | Type | Default | Description | |-------------|----------|-------------|-------------------------------------| | date | string | today | YYYY-MM-DD | | latitude | number | 0 | Geographic latitude (−90 to 90) | | longitude | number | 0 | Geographic longitude (−180 to 180) | | timezone | string | 'UTC' | IANA timezone identifier | | locale | Locale | 'en' | 'en', 'hi', or 'ta' |

Throws PanchangError with codes: INVALID_DATE, INVALID_LOCATION, CALCULATION_FAILED, EPHEMERIS_ERROR.

computeChart(birthInfo, locale?)

Returns a Promise<ChartResponse>.

interface BirthInfo {
  date:       string;      // YYYY-MM-DD
  time:       string;      // HH:MM (24-hour, local time)
  latitude:   number;
  longitude:  number;
  timezone?:  string;      // IANA, defaults to 'UTC'
  ayanamsa?:  AyanamsaId;  // defaults to 'lahiri'
}

Supported ayanamsas: lahiri, kp_new, kp_old, raman, kp_khullar, sayan, manoj

Throws ChartError with codes: INVALID_BIRTH_INFO, CALCULATION_FAILED, EPHEMERIS_ERROR.

Configuration

Ephemeris engine

The engine is @swisseph/browser (WebAssembly). init() is async and should be awaited once before calling the calculation functions (the public compute* functions auto-initialize):

import { EphemerisService } from 'vpv-panchangam';

const ephe = EphemerisService.getInstance();
await ephe.init({ ayanamsa: 'lahiri' }); // default

If you never call init() yourself, computeDetailedPanchang() / computeChart() initialize the engine (with the default lahiri ayanamsa) on first use.

Timezone

Unlike the Python backend, this library has no built-in coordinate-to-timezone lookup. Pass the IANA timezone string explicitly. If you need automatic resolution, use a package like geo-tz:

import { find } from 'geo-tz';
const [timezone] = find(lat, lon);

Locale system

All three locales are bundled and resolved at runtime:

import { getLocaleTable, resolveName } from 'vpv-panchangam';

const table = getLocaleTable('ta');
console.log(table.nakshatras[0]); // "அஸ்வினி"

const name = resolveName(0, 'nakshatras', 'hi');
console.log(name); // "अश्विनी"

Architecture

src/
├── index.ts               # Public barrel export
├── types.ts               # All TypeScript interfaces + error classes
├── locales/               # en, hi, ta locale tables
├── constants/             # Lookup tables (BAV rules, dashas, muhurta tables, etc.)
├── ephemeris/             # Swiss Ephemeris adapter (@swisseph/browser WASM wrapper)
├── calculations/          # Pure calculation modules
│   ├── bisection.ts       # Angular boundary search engine
│   ├── panchang.ts        # Tithi/nakshatra/yoga/karana index + sequence generators
│   ├── sunrise.ts         # Rise/set times + Udaya Lagna
│   ├── muhurta.ts         # Auspicious/inauspicious timing windows
│   ├── vargas.ts          # D1–D60 divisional charts
│   ├── dasha.ts           # Vimshottari dasha
│   ├── ashtakavarga.ts    # BAV + SAV
│   ├── placements.ts      # Special planetary placements
│   ├── jaimini.ts         # Chara karakas
│   ├── relationships.ts   # Planetary friendships
│   ├── aspects.ts         # Graha drishti
│   ├── kalsarpa.ts        # Kalsarpa yoga
│   ├── gowri.ts           # Gowri Panchangam
│   ├── hora.ts            # Planetary hora
│   ├── nalla-neram.ts     # Nalla Neram
│   ├── calendars.ts       # Multi-calendar conversions
│   ├── tyajyam/           # 10 tyajyam types
│   └── ganda-mula-ravi-yoga.ts
└── api/
    ├── get-panchang.ts    # computeDetailedPanchang() orchestration
    └── calculate.ts       # computeChart() orchestration

Development

npm run build        # Compile TypeScript → dist/
npm test             # Run Vitest test suite
npm run lint         # ESLint
npm run format       # Prettier
npm run test:watch   # Watch mode
npm run test:drik    # Run offline Drik parity test harness

DrikPanchang Parity

The panchang calculations reproduce DrikPanchang conventions as the library default, verified offline against committed reference fixtures.

What is DrikPanchang-compatible: calendar eras (Shaka/Vikram/Gujarati samvat + samvatsara names), amanta and purnimanta lunar month (derived from the last new moon), Kaliyuga year, paksha (from sunrise tithi), vara and karana spellings, all five muhurta/sandhya windows (Brahma, Pratah Sandhya, Vijaya, Godhuli, Sayahna Sandhya), varjyam and amrit kalam, dur muhurtam.

Fixture capture workflow (run once, not during npm test):

node scripts/capture-drik-fixtures.mjs   # ~90 s, requires internet

Captured fixtures are committed as JSON under test/fixtures/drik/. The parity test suite runs offline against those files:

npm run test:drik    # DRIK_PARITY=1 npx vitest run test/drik-parity.test.ts

Moonrise/moonset: The library evaluates moonrise and moonset within the panchang day [sunrise, nextSunrise) with the Moon's topocentric center at the geometric horizon (alt0 = 0°), matching DrikPanchang convention within 1 minute across all fixtures.

Note on Kelowna, BC (2026-11-09): On 2026-11-09, drikpanchang.com rendered wall-clock times for Kelowna in PDT (UTC−7) even though Daylight Saving Time in British Columbia ended on 2026-11-01 (PST, UTC−8). The library's astronomical UTC instants are correct.

License

MIT, aside from the bundled Swiss Ephemeris. @swisseph/browser (and the Swiss Ephemeris swisseph.wasm sidecar) is distributed under the AGPL-3.0 license by Astrodienst. If you use this package in a server or network service, the Swiss Ephemeris AGPL terms may apply to your distribution.