nepali-panchang-utils
v1.1.1
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
45
Maintainers
Readme
nepali-panchang-utils
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 nepali-panchang-utils
Usage 🔌
import { MhahPanchang } from 'nepali-panchang-utils';
// Or if you use CommonJS imports:
// const {MhahPanchang} = require('nepali-panchang-utils')
var obj = new MhahPanchang();
Sample code 📑
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);
Content 📖
- nepali-panchang-utils
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_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 |
Tithi
Example
console.log(mhahObj.Tithi);
Output
{
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 |
Nakshatra
Example
console.log(mhahObj.Nakshatra);
Output
{
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 |
Karna
Example
console.log(mhahObj.Karna);
Output
{
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 |
Yoga
Example
console.log(mhahObj.Yoga);
Output
{
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 |
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 }
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_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 |
Paksha
Example
console.log(mhahCal.Paksha);
Output
{
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 |
Nakshatra
Example
console.log(mhahCal.Nakshatra);
Output
{ 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 |
Yoga
Example
console.log(mhahCal.Yoga);
Output
{ 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 |
Karna
Example
console.log(mhahCal.Karna);
Output
{ 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 |
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
| Zodiac sign in custom language (default: Odia) |
| name_en_UK
| string
| Zodiac sign in English (UK) |
| ino
| number
| Index no. of Ritu |
Customize Name
Name variable can be customize with users own value.
setMhahConstant
To set custome variable Example
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
getMhahConstant
To get custome variable after its set or to see default variable Example
import { MhahPanchang } from 'nepali-panchang-utils';
let obj = new MhahPanchang();
console.log(obj.getMhahConstant('Day', 'name'));
Sun and Moon Timer
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
);
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