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).
npm install nepali-panchang-utilsIts 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).
Via npm:
``bash`
npm install --save nepali-panchang-utils
`javascript
import { MhahPanchang } from 'nepali-panchang-utils';
// Or if you use CommonJS imports:
// const {MhahPanchang} = require('nepali-panchang-utils')
var obj = new MhahPanchang();
`
`javascript
const { MhahPanchang } = require('nepali-panchang-utils');
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);
`
- nepali-panchang-utils
- Installation 🧱
- Usage 🔌
- Sample code 📑
- Content 📖
- Calculate
- Day
- Paksha
- Tithi
- Nakshatra
- Karna
- Yoga
- Ayanamsa
- Raasi
- Julian Date
- Calendar
- Tithi
- Paksha
- Nakshatra
- Yoga
- Karna
- Masa
- Raasi
- Ritu
- Customize Name
- setMhahConstant
- getMhahConstant
- Sun and Moon Timer
- solarNoon
- nadir
- sunRise
- sunSet
- sunRiseEnd
- sunSetStart
- dawn
- dusk
- nauticalDawn
- nauticalDusk
- nightEnd
- night
- License ⚖️
Here the Panchang calculation is focused on Date and Time taking in consideration the Julian Date, Sun and Moon.
`javascript`
//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 |
Example
`javascript`
console.log(mhahObj.Day);
Output
`chef`
{ 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 |
Example
`javascript`
console.log(mhahObj.Paksha);
Output
`chef`
{
ino: 1,
name: 'କୃଷ୍ଣ',
name_en_NP: 'Krishna',
name_en_UK: 'Waning Moon'
}
| Parameter | Type | Description |
| :----------- | :------- | :----------------------------------------- |
| name | string | Tithi in custom language (_default_: Odia) |name_en_NP
| | string | Tithi in English (India) |name_en_UK
| | string | Tithi in English (UK) |ino
| | number | Index no. of Tithi |
Example
`javascript`
console.log(mhahObj.Tithi);
Output
`chef`
{
name: 'ପଞ୍ଚମୀ',
name_en_NP: '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_NP
| | string | Tithi in English (India) |ino
| | number | Index no. of Tithi |start
| | Date | Start time of Tithi |end
| | Date | end time of Tithi |
Example
`javascript`
console.log(mhahObj.Nakshatra);
Output
`chef`
{
name: 'ସ୍ଵାତୀ',
name_en_NP: '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_NP
| | string | Nakshatra in English (India) |ino
| | number | Index no. of Nakshatra |start
| | Date | Start time of Nakshatra |end
| | Date | end time of Nakshatra |
Example
`javascript`
console.log(mhahObj.Karna);
Output
`chef`
{
name: 'ତୈତିଳ',
name_en_NP: '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_NP
| | string | Karna in English (India) |ino
| | number | Index no. of Karna |start
| | Date | Start time of Karna |end
| | Date | end time of Karna |
Example
`javascript`
console.log(mhahObj.Yoga);
Output
`chef`
{
name: 'ବୃଦ୍ଧି',
name_en_NP: '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_NP
| | string | Yoga in English (UK) |ino
| | number | Index no. of Yoga |start
| | Date | Start time of Yoga |end
| | Date | end time of Yoga |
Example
`javascript`
console.log(mhahObj.Ayanamsa);
Output
`chef24 9'48"
{ name: }`
Example
`javascript`
console.log(mhahObj.Raasi);
Output
`chef`
{ 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 |
Example
`javascript`
console.log(mhahObj.Julian);
Output
`chef`
{ date: 2459632.211111111, day: 2459632 }
Here the Panchang calculation is focused on Hindu Calendar.
`javascript
//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 |
Example
`javascript`
console.log(mhahCal.Tithi);
Output
`chef`
{ name: 'ଦ୍ଵାଦଶୀ', name_en_NP: 'Dvadasi', ino: 26 }
| Parameter | Type | Description |
| :----------- | :------- | :----------------------------------------- |
| name | string | Tithi in custom language (_default_: Odia) |name_en_NP
| | string | Tithi in English (IN) |ino
| | number | Index no. of Tithi |
Example
`javascript`
console.log(mhahCal.Paksha);
Output
`chef`
{
ino: 1,
name: 'କୃଷ୍ଣ',
name_en_NP: 'Krishna',
name_en_UK: 'Waning Moon'
}
| Parameter | Type | Description |
| :----------- | :------- | :------------------------------------------ |
| name | string | Paksha in custom language (_default_: Odia) |name_en_NP
| | string | Paksha in English (India) |name_en_UK
| | string | Paksha in English (UK) |ino
| | number | Index no. of Paksha |
Example
`javascript`
console.log(mhahCal.Nakshatra);
Output
`chef`
{ name: 'ପୂର୍ବଷାଢା', name_en_NP: 'Purva Ashadha', ino: 19 }
| Parameter | Type | Description |
| :----------- | :------- | :--------------------------------------------- |
| name | string | Nakshatra in custom language (_default_: Odia) |name_en_NP
| | string | Nakshatra in English (India) |ino
| | number | Index no. of Nakshatra |
Example
`javascript`
console.log(mhahCal.Yoga);
Output
`chef`
{ name: 'ବ୍ୟତିପାତ', name_en_NP: 'Vyatipata', ino: 16 }
| Parameter | Type | Description |
| :----------- | :------- | :---------------------------------------- |
| name | string | Yoga in custom language (_default_: Odia) |name_en_NP
| | string | Yoga in English (UK) |ino
| | number | Index no. of Yoga |
Example
`javascript`
console.log(mhahCal.Karna);
Output
`chef`
{ name: 'ବାଳବ', name_en_NP: 'Balava', ino: 1 }
| Parameter | Type | Description |
| :----------- | :------- | :----------------------------------------- |
| name | string | Karna in custom language (_default_: Odia) |name_en_NP
| | string | Karna in English (India) |ino
| | number | Index no. of Karna |
Example
`javascript`
console.log(mhahCal.Masa);
Output
`chef`
{
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 |
Example
`javascript`
console.log(mhahCal.Raasi);
Output
`chef`
{ 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 |
Example
`javascript`
console.log(mhahCal.Ritu);
Output
`chef`
{ ino: 5, name: 'ବସନ୍ତ', name_en_UK: 'Winter' }
| 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 Ritu |
Name variable can be customize with users own value.
To set custome variable
Example
`javascript`
import { MhahPanchang } from 'nepali-panchang-utils';
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
To get custome variable after its set or to see default variable
Example
`javascript`
import { MhahPanchang } from 'nepali-panchang-utils';
let obj = new MhahPanchang();
console.log(obj.getMhahConstant('Day', 'name'));
`javascript
import { MhahPanchang } from 'nepali-panchang-utils';
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
);
`
Time when sun is in the highest position.
Example
`javascript`
console.log(mhahCal.solarNoon).toEqual(new Date('2022-02-26T07:04:04.744Z'));
Time when darkest moment of the night, sun is in the lowest position.
Example
`javascript`
console.log(mhahCal.nadir).toEqual(new Date('2022-02-25T19:04:04.744Z'));
Top edge of the sun appears on the horizon
Example
`javascript`
console.log(mhahCal.sunRise);
Sun disappears below the horizon, evening civil twilight starts
Example
`javascript`
console.log(mhahCal.sunSet);
Bottom edge of the sun touches the horizon
Example
`javascript`
console.log(mhahCal.sunRiseEnd);
Bottom edge of the sun touches the horizon
Example
`javascript`
console.log(mhahCal.sunSetStart);
Morning nautical twilight ends, morning civil twilight starts
Example
`javascript`
console.log(mhahCal.dawn);
Evening nautical twilight starts
Example
`javascript`
console.log(mhahCal.dusk);
Morning nautical twilight starts
Example
`javascript`
console.log(mhahCal.nauticalDawn);
Evening astronomical twilight starts
Example
`javascript`
console.log(mhahCal.nauticalDusk);
Morning astronomical twilight starts
Example
`javascript`
console.log(mhahCal.nightEnd);
Dark enough for astronomical observations
Example
`javascript``
console.log(mhahCal.night);
MPL