UNPKG

@ishubhamx/panchangam-js

Version:

Enhanced Indian Panchangam (Hindu Calendar) library with comprehensive Vedic features including Muhurta calculations, planetary positions, Rashi placements, and auspicious/inauspicious time calculations

53 lines 2.12 kB
"use strict"; /** * Chandrashtama - Moon in 8th from Birth Rashi * * When the transiting Moon is in the 8th sign from one's birth Moon sign (Janma Rashi), * it's considered an inauspicious period lasting approximately 2.5 days each month. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getChandrashtama = getChandrashtama; exports.getChandrashtamaRashi = getChandrashtamaRashi; const constants_1 = require("./constants"); /** * Calculate Chandrashtama status based on birth Rashi and current Moon position * * @param birthRashi - Birth Moon Rashi index (0 = Aries/Mesh, 11 = Pisces/Meen) * @param currentMoonRashi - Current transiting Moon's Rashi index (0-11) * @returns ChandrashtamaInfo object with active status and Rashi details * * @example * ```typescript * // Person born with Moon in Aries (0), current Moon in Scorpio (7) * const info = getChandrashtama(0, 7); * console.log(info.isActive); // true (Scorpio is 8th from Aries) * ``` */ function getChandrashtama(birthRashi, currentMoonRashi) { // Normalize inputs to 0-11 range const normalizedBirth = ((birthRashi % 12) + 12) % 12; const normalizedCurrent = ((currentMoonRashi % 12) + 12) % 12; // 8th house is 7 signs ahead (0-indexed) // Example: Aries (0) → 8th house is Scorpio (0 + 7 = 7) const chandrashtamaRashi = (normalizedBirth + 7) % 12; const isActive = normalizedCurrent === chandrashtamaRashi; return { isActive, birthRashi: normalizedBirth, birthRashiName: constants_1.rashiNames[normalizedBirth], chandrashtamaRashi, chandrashtamaRashiName: constants_1.rashiNames[chandrashtamaRashi], currentMoonRashi: normalizedCurrent, currentMoonRashiName: constants_1.rashiNames[normalizedCurrent], }; } /** * Get the Chandrashtama Rashi for a given birth Rashi * * @param birthRashi - Birth Moon Rashi index (0-11) * @returns The Rashi index that causes Chandrashtama (0-11) */ function getChandrashtamaRashi(birthRashi) { return ((birthRashi % 12) + 12 + 7) % 12; } //# sourceMappingURL=chandrashtama.js.map