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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mhah-panchang

v1.2.0

Published

Its a cool package build to calculate Tithi (Moon), Nakshatra, Karna, Yoga, Raasi (Zodic Sign) and Ayanamsa. It can also be use to predict Masa(Hindu month) and Ritu (season).

Downloads

95

Readme

Mhah-Panchang

Its a cool package build to calculate Tithi (Moon), Nakshatra, Karna, Yoga, Raasi (Zodic Sign) and Ayanamsa. It can also be use to predict Masa(Hindu month) and Ritu (season).

Installation 🧱

Via npm:

npm install --save mhah-panchang

Usage 🔌

import { MhahPanchang } from 'mhah-panchanga';
// Or if you use CommonJS imports:
// const {MhahPanchang} = require('mhah-panchanga')

var obj = new MhahPanchang();

Sample code 📑

const { MhahPanchang } = require('mhah-panchang');

var obj = new MhahPanchang();

// Based current date and time : calculate(date)
var mhahObj = obj.calculate(new Date('2022-02-21T11:34:11.000Z'));
console.log(mhahObj);

// Based regular Hindu Calendar details : calendar(date, latitude, longitude)
let mhahCal = obj.calendar(
  new Date('2022-02-27T05:22:43.984Z'),
  12.972,
  77.594
);
console.log(mhahCal);

Content 📖

Calculate

Here the Panchang calculation is focused on Date and Time taking in consideration the Julian Date, Sun and Moon.

//calculate(date)
//Example
var mhahObj = obj.calculate(new Date('2022-02-21T11:34:11.000Z'));
console.log(mhahObj.Day);

Inputs

| Parameter | Type | Description | | :-------- | :----- | :------------------------------- | | date | Date | Date for which details is needed |

Day

Example

console.log(mhahObj.Day);

Output

{ ino: 1, name: 'ସୋମବାର', name_en_UK: 'Monday' }

| Parameter | Type | Description | | :----------- | :------- | :--------------------------------------- | | name | string | Day in custom language (default: Odia) | | name_en_UK | string | Day in English (UK) | | ino | number | Index no. of Day |

Paksha

Example

console.log(mhahObj.Paksha);

Output

{
    ino: 1,
    name: 'କୃଷ୍ଣ',
    name_en_IN: 'Krishna',
    name_en_UK: 'Waning Moon'
}

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------- | | name | string | Tithi in custom language (default: Odia) | | name_en_IN | string | Tithi in English (India) | | name_en_UK | string | Tithi in English (UK) | | ino | number | Index no. of Tithi |

Tithi

Example

console.log(mhahObj.Tithi);

Output

{
    name: 'ପଞ୍ଚମୀ',
    name_en_IN: 'Panchami',
    ino: 19,
    start: 2022-02-20T15:35:33.000Z,
    end: 2022-02-21T14:27:50.000Z
}

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------- | | name | string | Tithi in custom language (default: Odia) | | name_en_IN | string | Tithi in English (India) | | ino | number | Index no. of Tithi | | start | Date | Start time of Tithi | | end | Date | end time of Tithi |

Nakshatra

Example

console.log(mhahObj.Nakshatra);

Output

{
    name: 'ସ୍ଵାତୀ',
    name_en_IN: 'Swati',
    ino: 14,
    start: 2022-02-21T10:46:30.000Z,
    end: 2022-02-22T10:05:49.000Z
}

| Parameter | Type | Description | | :----------- | :------- | :--------------------------------------------- | | name | string | Nakshatra in custom language (default: Odia) | | name_en_IN | string | Nakshatra in English (India) | | ino | number | Index no. of Nakshatra | | start | Date | Start time of Nakshatra | | end | Date | end time of Nakshatra |

Karna

Example

console.log(mhahObj.Karna);

Output

{
    name: 'ତୈତିଳ',
    name_en_IN: 'Taitula',
    ino: 3,
    start: 2022-02-21T03:03:39.000Z,
    end: 2022-02-21T14:27:50.000Z
}

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------- | | name | string | Karna in custom language (default: Odia) | | name_en_IN | string | Karna in English (India) | | ino | number | Index no. of Karna | | start | Date | Start time of Karna | | end | Date | end time of Karna |

Yoga

Example

console.log(mhahObj.Yoga);

Output

{
    name: 'ବୃଦ୍ଧି',
    name_en_IN: 'Vridhi',
    ino: 10,
    start: 2022-02-21T07:34:10.000Z,
    end: 2022-02-22T05:20:00.000Z
}

| Parameter | Type | Description | | :----------- | :------- | :---------------------------------------- | | name | string | Yoga in custom language (default: Odia) | | name_en_IN | string | Yoga in English (UK) | | ino | number | Index no. of Yoga | | start | Date | Start time of Yoga | | end | Date | end time of Yoga |

Ayanamsa

Example

console.log(mhahObj.Ayanamsa);

Output

{ name: `24 9'48"` }

Raasi

Example

console.log(mhahObj.Raasi);

Output

{ name: 'ତୁଳା', ino: 6, name_en_UK: 'Libra' }

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------------- | | name | string | Zodiac sign in custom language (default: Odia) | | name_en_UK | string | Zodiac sign in English (UK) | | ino | number | Index no. of Zodiac sign |

Julian Date

Example

console.log(mhahObj.Julian);

Output

{ date: 2459632.211111111, day: 2459632 }

Gana

Example

console.log(mhahObj.Gana);

Output

{
    "ino": 0,
    "name_en_IN": "Devata",
    "name_en_UK": "God",
    "name": "ଦେବତା"
}

| Parameter | Type | Description | | :----------- | :------- | :------------------------------------------ | | name | string | Gana in custom language (default: Odia) | | name_en_IN | string | Gana in English (India) | | name_en_UK | string | Gana in English (UK) | | ino | number | Index no. of Gana |

Guna

Example

console.log(mhahObj.Guna);

Output

{
  "ino": 0,
  "name_en_IN": "Rajas",
  "name_en_UK": "passion, activity, movement",
  "name": "ରାଜସ୍"
}

| Parameter | Type | Description | | :----------- | :------- | :------------------------------------------ | | name | string | Guna in custom language (default: Odia) | | name_en_IN | string | Guna in English (India) | | name_en_UK | string | Guna in English (UK) | | ino | number | Index no. of Guna |

Trinity

Example

console.log(mhahObj.Trinity);

Output

{
  "ino": 1,
  "name_en_IN": "Vishnu",
  "name": "ବିଷ୍ଣୁ"
}

| Parameter | Type | Description | | :----------- | :------- | :------------------------------------------ | | name | string | Trinity in custom language (default: Odia) | | name_en_IN | string | Trinity in English (India) | | ino | number | Index no. of Trinity |

Calendar

Here the Panchang calculation is focused on Hindu Calendar.

//calendar(date, latitude, longitude)
// Example
let mhahCal = obj.calendar(
  new Date('2022-02-27T05:22:43.984Z'),
  12.972,
  77.594
);

console.log(mhahCal);

Inputs

| Parameter | Type | Description | | :---------- | :------- | :------------------------------- | | date | Date | Date for which details is needed | | latitude | number | Latitude coordinate of Place | | longitude | number | Longitude coordinate of Place |

Tithi

Example

console.log(mhahCal.Tithi);

Output

{ name: 'ଦ୍ଵାଦଶୀ', name_en_IN: 'Dvadasi', ino: 26 }

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------- | | name | string | Tithi in custom language (default: Odia) | | name_en_IN | string | Tithi in English (IN) | | ino | number | Index no. of Tithi |

Paksha

Example

console.log(mhahCal.Paksha);

Output

{
    ino: 1,
    name: 'କୃଷ୍ଣ',
    name_en_IN: 'Krishna',
    name_en_UK: 'Waning Moon'
}

| Parameter | Type | Description | | :----------- | :------- | :------------------------------------------ | | name | string | Paksha in custom language (default: Odia) | | name_en_IN | string | Paksha in English (India) | | name_en_UK | string | Paksha in English (UK) | | ino | number | Index no. of Paksha |

Nakshatra

Example

console.log(mhahCal.Nakshatra);

Output

{ name: 'ପୂର୍ବଷାଢା', name_en_IN: 'Purva Ashadha', ino: 19 }

| Parameter | Type | Description | | :----------- | :------- | :--------------------------------------------- | | name | string | Nakshatra in custom language (default: Odia) | | name_en_IN | string | Nakshatra in English (India) | | ino | number | Index no. of Nakshatra |

Yoga

Example

console.log(mhahCal.Yoga);

Output

{ name: 'ବ୍ୟତିପାତ', name_en_IN: 'Vyatipata', ino: 16 }

| Parameter | Type | Description | | :----------- | :------- | :---------------------------------------- | | name | string | Yoga in custom language (default: Odia) | | name_en_IN | string | Yoga in English (UK) | | ino | number | Index no. of Yoga |

Karna

Example

console.log(mhahCal.Karna);

Output

{ name: 'ବାଳବ', name_en_IN: 'Balava', ino: 1 }

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------- | | name | string | Karna in custom language (default: Odia) | | name_en_IN | string | Karna in English (India) | | ino | number | Index no. of Karna |

Masa

Example

console.log(mhahCal.Masa);

Output

{
    ino: 10,
    name: 'ଫାଲ୍ଗୁନ',
    name_en_UK: 'Phalguna'
}

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------------- | | name | string | Zodiac sign in custom language (default: Odia) | | name_en_UK | string | Zodiac sign in English (UK) | | ino | number | Index no. of Zodiac sign |

Raasi

Example

console.log(mhahCal.Raasi);

Output

{ ino: 10, name_en_UK: 'Aquarius', name: 'କୁମ୍ଭ' }

| Parameter | Type | Description | | :----------- | :------- | :----------------------------------------------- | | name | string | Zodiac sign in custom language (default: Odia) | | name_en_UK | string | Zodiac sign in English (UK) | | ino | number | Index no. of Zodiac sign |

Ritu

Example

console.log(mhahCal.Ritu);

Output

{ ino: 5, name: 'ବସନ୍ତ', name_en_UK: 'Winter' }

| Parameter | Type | Description | | :----------- | :------- | :--------------------------------------------- | | name | string | Ritu sign in custom language (default: Odia) | | name_en_UK | string | Ritu sign in English (UK) | | ino | number | Index no. of Ritu |

Gana

Example

console.log(mhahObj.Gana);

Output

{
  "ino": 1,
  "name_en_IN": "Manushya",
  "name_en_UK": "Human",
  "name": "ମନୁଷ୍ୟ"
}

| Parameter | Type | Description | | :----------- | :------- | :---------------------------------------- | | name | string | Gana in custom language (default: Odia) | | name_en_IN | string | Gana in English (India) | | name_en_UK | string | Gana in English (UK) | | ino | number | Index no. of Gana |

Guna

Example

console.log(mhahObj.Guna);

Output

{
    "ino": 1,
    "name_en_IN": "Tamas",
    "name_en_UK": "ignorance, inertia, laziness",
    "name": "ତମାସ୍"
}

| Parameter | Type | Description | | :----------- | :------- | :---------------------------------------- | | name | string | Guna in custom language (default: Odia) | | name_en_IN | string | Guna in English (India) | | name_en_UK | string | Guna in English (UK) | | ino | number | Index no. of Guna |

Trinity

Example

console.log(mhahObj.Trinity);

Output

{
  "ino": 2,
  "name_en_IN": "Shiva",
  "name": "ଶିବ"
}

| Parameter | Type | Description | | :----------- | :------- | :------------------------------------------ | | name | string | Trinity in custom language (default: Odia) | | name_en_IN | string | Trinity in English (India) | | ino | number | Index no. of Trinity |

Customize Name

Name variable can be customize with users own value.

setMhahConstant

To set custome variable Example

import { MhahPanchang } from 'mhah-panchanga';
let obj = new MhahPanchang();
let customArray = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
obj.setMhahConstant('Day', 'name', customArray);
var mhahObj = obj.calculate(new Date('2022-02-21T11:34:11.000Z'));
console.log(mhahObj.Day.name); // Mon

getMhahConstant

To get custome variable after its set or to see default variable Example

import { MhahPanchang } from 'mhah-panchanga';
let obj = new MhahPanchang();
console.log(obj.getMhahConstant('Day', 'name'));

Sun and Moon Timer

import { MhahPanchang } from 'mhah-panchanga';
let obj = new MhahPanchang();

// Based Day important timing : calendar(date, latitude, longitude)
let mhahCal = obj.sunTimer(
  new Date('2022-02-26T05:22:43.984Z'),
  12.972,
  77.594
);

solarNoon

Time when sun is in the highest position.

Example

console.log(mhahCal.solarNoon).toEqual(new Date('2022-02-26T07:04:04.744Z'));

nadir

Time when darkest moment of the night, sun is in the lowest position.

Example

console.log(mhahCal.nadir).toEqual(new Date('2022-02-25T19:04:04.744Z'));

sunRise

Top edge of the sun appears on the horizon

Example

console.log(mhahCal.sunRise);

sunSet

Sun disappears below the horizon, evening civil twilight starts

Example

console.log(mhahCal.sunSet);

sunRiseEnd

Bottom edge of the sun touches the horizon

Example

console.log(mhahCal.sunRiseEnd);

sunSetStart

Bottom edge of the sun touches the horizon

Example

console.log(mhahCal.sunSetStart);

dawn

Morning nautical twilight ends, morning civil twilight starts

Example

console.log(mhahCal.dawn);

dusk

Evening nautical twilight starts

Example

console.log(mhahCal.dusk);

nauticalDawn

Morning nautical twilight starts

Example

console.log(mhahCal.nauticalDawn);

nauticalDusk

Evening astronomical twilight starts

Example

console.log(mhahCal.nauticalDusk);

nightEnd

Morning astronomical twilight starts

Example

console.log(mhahCal.nightEnd);

night

Dark enough for astronomical observations

Example

console.log(mhahCal.night);

License ⚖️

MPL