Skip to content

Commit 10c67ec

Browse files
committed
added panchanga components with debug information in modal window
1 parent c0c9525 commit 10c67ec

File tree

11 files changed

+418
-236
lines changed

11 files changed

+418
-236
lines changed

bikram-calendar/src/constants.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,74 @@ export const solarMonthNames = [
8686
"Baisakh", "Jestha", "Ashadh", "Shrawan", "Bhadra", "Ashwin",
8787
"Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"
8888
];
89+
90+
/** Array of Tithi names (lunar days) in the Hindu calendar (Nepali transliteration).
91+
* Contains 30 entries representing the lunar phases:
92+
* - First 15 entries are for Shukla Paksha (waxing moon phase)
93+
* - Last 15 entries are for Krishna Paksha (waning moon phase)
94+
* @readonly
95+
*/
96+
export const tithiNp = [
97+
"प्रतिपदा", "द्वितीया", "तृतीया", "चतुर्थी", "पञ्चमी",
98+
"षष्ठी", "सप्तमी", "अष्टमी", "नवमी", "दशमी", "एकादशी",
99+
"द्वादशी", "त्रयोदशी", "चतुर्दशी", "पूर्णिमा", "प्रतिपदा",
100+
"द्वितीया", "तृतीया", "चतुर्थी", "पञ्चमी", "षष्ठी",
101+
"सप्तमी", "अष्टमी", "नवमी", "दशमी", "एकादशी",
102+
"द्वादशी", "त्रयोदशी", "चतुर्दशी", "औंसी"
103+
];
104+
105+
/** Array of Nakshatra names (lunar mansions/constellations) in the Hindu calendar (Nepali transliteration).
106+
* Contains 27 entries representing the celestial divisions along the ecliptic
107+
* through which the moon passes during its monthly cycle.
108+
* @readonly
109+
*/
110+
export const nakshatraNp = [
111+
"अश्विनी", "भरणी", "कृत्तिका", "रोहिणी", "मृगशिरा", "आर्द्रा",
112+
"पुनर्वसु", "पुष्य", "आश्लेषा", "मघा", "पूर्व फाल्गुनी", "उत्तर फाल्गुनी",
113+
"हस्त", "चित्रा", "स्वाति", "विशाखा", "अनुराधा", "ज्येष्ठा", "मूल",
114+
"पूर्वाषाढा", "उत्तराषाढा", "श्रवण", "धनिष्ठा", "शतभिषा",
115+
"पूर्व भाद्रपद", "उत्तर भाद्रपद", "रेवती"
116+
];
117+
118+
/** Array of Rashi names (zodiac signs) in the Hindu calendar (Nepali transliteration).
119+
* Contains 12 entries representing the zodiacal constellations
120+
* through which the sun appears to pass during its yearly cycle.
121+
* @readonly
122+
*/
123+
export const rashiNp = [
124+
"मेष", "वृष", "मिथुन", "कर्कट", "सिंह", "कन्या",
125+
"तुला", "वृश्चिक", "धनु", "मकर", "कुम्भ", "मीन"
126+
];
127+
128+
/** Array of Karana names (half of a lunar day) in the Hindu calendar (Nepali transliteration).
129+
* Contains 11 entries representing the different karanas that repeat
130+
* in a cycle throughout the lunar month.
131+
* @readonly
132+
*/
133+
export const karanNp = [
134+
"बव", "बालव", "कौलव", "तैतिल", "गर", "वणिज",
135+
"विष्टि", "शकुनि", "चतुष्पद", "नाग", "किंस्तुघ्न"
136+
];
137+
138+
/** Array of Yoga names in the Hindu calendar (Nepali transliteration).
139+
* Contains 27 entries representing the angular relationship
140+
* between the sun and moon, calculated by their joint motion.
141+
* @readonly
142+
*/
143+
export const yogaNp = [
144+
"विश्कम्भ", "प्रीति", "आयुष्मान", "सौभाग्य", "शोभन",
145+
"अतिगण्ड", "सुकर्मा", "धृति", "शूल", "गण्ड", "वृद्धि",
146+
"ध्रुव", "व्याघात", "हर्षण", "वज्र", "सिद्धि", "व्यतीपात",
147+
"वरीयान", "परिघ", "शिव", "सिद्ध", "साध्य", "शुभ", "शुक्ल",
148+
"ब्रह्मा", "इन्द्र", "वैधृति"
149+
];
150+
151+
/** Array of Solar Month names in the Hindu calendar (Nepal variant) (Nepali transliteration).
152+
* Contains 12 entries representing the solar months
153+
* as used in the traditional Nepali calendar.
154+
* @readonly
155+
*/
156+
export const solarMonthNamesNp = [
157+
"बैशाख", "जेठ", "असार", "श्रावण", "भदौ", "आश्विन",
158+
"कार्तिक", "मंसिर", "पुष", "माघ", "फाल्गुन", "चैत्र"
159+
];

bikram-calendar/src/panchanga.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
import { tithi, nakshatra, rashi, karan, yoga, solarMonthNames } from './constants';
19+
import { tithi, nakshatra, rashi, karan, yoga, solarMonthNames, tithiNp, nakshatraNp, rashiNp, karanNp, yogaNp, solarMonthNamesNp } from './constants';
2020

2121

2222
// --- Constants ---
@@ -481,7 +481,7 @@ export function calculatePanchanga(dateObj: Date) {
481481
const tithiAngle = (siderealMoon - siderealSun < 0) ? siderealMoon - siderealSun + 360 : siderealMoon - siderealSun;
482482
const tithiIndex = Math.floor(tithiAngle / 12);
483483
const dtithi = tithi[tithiIndex];
484-
const dpaksha = tithiIndex < 15 ? "Shukla" : "Krishna";
484+
const dpaksha = tithiIndex < 15 ? "Shuklapaksha" : "Krishnapaksha";
485485

486486
const nakshatraIndex = Math.floor(siderealMoon / (360 / 27));
487487
const dnakshatra = nakshatra[nakshatraIndex];
@@ -533,7 +533,8 @@ export function calculatePanchanga(dateObj: Date) {
533533
tithiEnd: tithiEnd || 'N/A',
534534
sunrise: sunriseStr || 'N/A',
535535
sunset: sunsetStr || 'N/A',
536-
debug: debugOutput
536+
debug: debugOutput,
537+
tithiIndex
537538
};
538539
}
539540

@@ -578,5 +579,11 @@ export {
578579
jdToDateParts,
579580
calculateTithiTimes,
580581
crossedRashiBoundary,
581-
calculateSolarDayDetails
582+
calculateSolarDayDetails,
583+
tithiNp,
584+
nakshatraNp,
585+
rashiNp,
586+
karanNp,
587+
yogaNp,
588+
solarMonthNamesNp
582589
};

docs/404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<link href="https://fonts.googleapis.com/css2?family=Lohit+Devanagari&display=swap" rel="stylesheet">
1818
<!-- Print stylesheet -->
1919
<link rel="stylesheet" href="./print.css" media="print">
20-
<script type="module" crossorigin src="./assets/index-C_AtZiua.js"></script>
21-
<link rel="stylesheet" crossorigin href="./assets/index-fmTXRpHI.css">
20+
<script type="module" crossorigin src="./assets/index-BdVvpjz5.js"></script>
21+
<link rel="stylesheet" crossorigin href="./assets/index-CBfEqjCd.css">
2222
</head>
2323

2424
<body>

0 commit comments

Comments
 (0)