@bhanulabs/desical 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/astro.js ADDED
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+ // Astronomical primitives for the panchangam, built on astronomy-engine.
3
+ const A = require('astronomy-engine');
4
+ const { DAY } = require('./time');
5
+
6
+ const norm = (x) => ((x % 360) + 360) % 360;
7
+ const wrap180 = (x) => { x = norm(x); return x > 180 ? x - 360 : x; };
8
+ const jd = (date) => date.getTime() / DAY + 2440587.5;
9
+
10
+ /** Lahiri (Chitrapaksha) ayanamsa in degrees. */
11
+ function ayanamsa(date) {
12
+ const T = (jd(date) - 2415020.0) / 36525; // centuries from J1900
13
+ return 22.460148 + 1.396888 * T + 0.000308 * T * T;
14
+ }
15
+
16
+ const sunTropical = (d) => A.SunPosition(d).elon;
17
+ const moonTropical = (d) => A.EclipticGeoMoon(d).lon;
18
+ const sunSidereal = (d) => norm(sunTropical(d) - ayanamsa(d));
19
+ const moonSidereal = (d) => norm(moonTropical(d) - ayanamsa(d));
20
+ const yogaAngle = (d) => norm(sunTropical(d) + moonTropical(d) - 2 * ayanamsa(d));
21
+ /** Moon − Sun elongation, 0..360 (tithi = elongation / 12). */
22
+ const moonPhase = (d) => A.MoonPhase(d);
23
+
24
+ /** Next instant (after `start`) when the Moon−Sun elongation equals `deg`. */
25
+ function searchPhase(deg, start, limitDays = 40) {
26
+ const t = A.SearchMoonPhase(norm(deg), start, limitDays);
27
+ return t ? t.date : null;
28
+ }
29
+
30
+ /**
31
+ * Next instant after t0 at which the increasing angle fn(t) reaches `target`.
32
+ * Newton/secant iteration; angles are handled modulo 360.
33
+ */
34
+ function searchAngle(fn, target, t0) {
35
+ let t = t0.getTime();
36
+ const h = 3600000;
37
+ let diff = norm(target - fn(new Date(t)));
38
+ if (diff > 359.99999) diff -= 360;
39
+ for (let i = 0; i < 30; i++) {
40
+ const a = fn(new Date(t));
41
+ const rate = wrap180(fn(new Date(t + h)) - a) / h; // deg per ms
42
+ const d = i === 0 ? diff : wrap180(target - a);
43
+ if (Math.abs(d) < 1e-6) break;
44
+ t += d / rate;
45
+ }
46
+ return new Date(t);
47
+ }
48
+
49
+ /** Generic "which segment are we in and when does it end" helper. */
50
+ function segment(fn, width, t) {
51
+ const v = fn(t);
52
+ const idx = Math.floor(v / width);
53
+ const end = searchAngle(fn, ((idx + 1) * width) % 360, t);
54
+ return { idx, end };
55
+ }
56
+
57
+ function tithiAt(t) {
58
+ const p = moonPhase(t);
59
+ const idx = Math.floor(p / 12); // 0..29
60
+ const end = searchPhase((idx + 1) * 12, t, 3);
61
+ // A tithi lasts < 27 h, so its start is the only crossing of idx*12° in the 1.5 days before t.
62
+ const start = searchPhase(idx * 12, new Date(t.getTime() - 1.5 * DAY), 2);
63
+ return { num: idx + 1, start, end };
64
+ }
65
+
66
+ function karanaAt(t) {
67
+ const idx = Math.floor(moonPhase(t) / 6); // 0..59
68
+ const end = searchPhase((idx + 1) * 6, t, 2);
69
+ return { idx, end };
70
+ }
71
+
72
+ /** Nakshatra at t, with its start and end instants (a nakshatra lasts < 1.2 days). */
73
+ function nakshatraAt(t) {
74
+ const { idx, end } = segment(moonSidereal, 360 / 27, t);
75
+ const start = searchAngle(moonSidereal, idx * (360 / 27), new Date(t.getTime() - 1.5 * DAY));
76
+ return { idx, start, end };
77
+ }
78
+ const yogaAt = (t) => segment(yogaAngle, 360 / 27, t);
79
+
80
+ /** Instant the Sun reaches sidereal longitude `lon` (searching forward from t0). */
81
+ const sankrantiAfter = (lon, t0) => searchAngle(sunSidereal, lon, t0);
82
+
83
+ function riseSet(body, observer, direction, start, limitDays = 1) {
84
+ const r = A.SearchRiseSet(body, observer, direction, start, limitDays);
85
+ return r ? r.date : null;
86
+ }
87
+
88
+ module.exports = {
89
+ A, norm, wrap180, ayanamsa, sunTropical, moonTropical, sunSidereal, moonSidereal, moonPhase,
90
+ searchPhase, searchAngle, tithiAt, karanaAt, nakshatraAt, yogaAt, sankrantiAfter, riseSet,
91
+ };
@@ -0,0 +1,322 @@
1
+ 'use strict';
2
+ // Festivals, holidays and observances for a Gregorian year.
3
+ const astro = require('./astro');
4
+ const { A } = astro;
5
+ const T = require('./time');
6
+ const N = require('./names');
7
+
8
+ const { DAY } = T;
9
+
10
+ /*
11
+ * Event types:
12
+ * festival major Hindu festival telugu Telugu-region festival
13
+ * national Indian national holiday state Telangana / AP state day
14
+ * islamic Islamic festival christian Christian festival
15
+ * intl international holiday observance day of observance
16
+ * astro full/new moon, sankranti, eclipse
17
+ * vrata monthly vratas (Ekadashi, Pradosham, ...)
18
+ */
19
+
20
+ // Lunar festivals: month index (0 = Chaitra), tithi 1..30 (16..30 = Bahula/Krishna), kala rule.
21
+ const LUNAR = [
22
+ { m: 0, t: 1, kala: 'sunrise', type: 'telugu', en: 'Ugadi (Telugu New Year)', te: 'ఉగాది', aliases: ['yugadi', 'gudi padwa', 'new year'] },
23
+ { m: 0, t: 9, kala: 'madhyahna', type: 'festival', en: 'Sri Rama Navami', te: 'శ్రీరామ నవమి', aliases: ['ram navami', 'rama navami'] },
24
+ { m: 0, t: 13, kala: 'sunrise', type: 'festival', en: 'Mahavir Jayanti', te: 'మహావీర్ జయంతి' },
25
+ { m: 0, t: 15, kala: 'sunrise', type: 'festival', en: 'Hanuman Jayanti (North India)', te: 'హనుమాన్ జయంతి (ఉత్తర భారతం)' },
26
+ { m: 1, t: 3, kala: 'sunrise', type: 'festival', en: 'Akshaya Tritiya', te: 'అక్షయ తృతీయ', aliases: ['akshaya tadiya'] },
27
+ { m: 1, t: 14, kala: 'pradosha', type: 'festival', en: 'Narasimha Jayanti', te: 'నృసింహ జయంతి' },
28
+ { m: 1, t: 15, kala: 'sunrise', type: 'festival', en: 'Buddha Purnima', te: 'బుద్ధ పూర్ణిమ' },
29
+ { m: 1, t: 25, kala: 'sunrise', type: 'telugu', en: 'Hanuman Jayanti', te: 'హనుమాన్ జయంతి' },
30
+ { m: 3, t: 2, kala: 'sunrise', type: 'festival', en: 'Jagannath Rath Yatra', te: 'జగన్నాథ రథయాత్ర' },
31
+ { m: 3, t: 11, kala: 'sunrise', type: 'telugu', en: 'Tholi Ekadashi', te: 'తొలి ఏకాదశి', aliases: ['devshayani', 'shayani ekadashi'] },
32
+ { m: 3, t: 15, kala: 'sunrise', type: 'festival', en: 'Guru Purnima (Vyasa Purnima)', te: 'గురు పూర్ణిమ' },
33
+ { m: 4, t: 5, kala: 'sunrise', type: 'festival', en: 'Naga Panchami', te: 'నాగ పంచమి' },
34
+ { m: 4, t: 15, kala: 'sunrise', type: 'festival', en: 'Raksha Bandhan (Rakhi Pournami)', te: 'రాఖీ పౌర్ణమి', aliases: ['rakhi', 'shravana purnima'] },
35
+ { m: 4, t: 23, kala: 'sunrise', type: 'festival', en: 'Sri Krishna Janmashtami', te: 'శ్రీ కృష్ణ జన్మాష్టమి', aliases: ['krishnashtami', 'janmashtami', 'gokulashtami'] },
36
+ { m: 5, t: 4, kala: 'madhyahna', type: 'festival', en: 'Vinayaka Chavithi', te: 'వినాయక చవితి', aliases: ['ganesh chaturthi', 'ganesha'] },
37
+ { m: 5, t: 14, kala: 'sunrise', type: 'telugu', en: 'Ananta Chaturdashi (Ganesh Nimajjanam)', te: 'అనంత చతుర్దశి (గణేశ నిమజ్జనం)' },
38
+ { m: 5, t: 30, kala: 'sunrise', type: 'festival', en: 'Mahalaya Amavasya', te: 'మహాలయ అమావాస్య' },
39
+ { m: 5, t: 30, kala: 'sunrise', type: 'telugu', en: 'Engili Pula Bathukamma (Bathukamma begins)', te: 'ఎంగిలి పూల బతుకమ్మ', aliases: ['bathukamma'] },
40
+ { m: 6, t: 1, kala: 'sunrise', type: 'festival', en: 'Devi Navaratri begins', te: 'దేవీ నవరాత్రులు ప్రారంభం', aliases: ['navratri', 'dasara'] },
41
+ { m: 6, t: 8, kala: 'sunrise', type: 'festival', en: 'Durgashtami', te: 'దుర్గాష్టమి', aliases: ['durga ashtami'] },
42
+ { m: 6, t: 8, kala: 'sunrise', type: 'telugu', en: 'Saddula Bathukamma', te: 'సద్దుల బతుకమ్మ', aliases: ['bathukamma'] },
43
+ { m: 6, t: 9, kala: 'sunrise', type: 'festival', en: 'Maharnavami', te: 'మహార్నవమి', aliases: ['ayudha puja'] },
44
+ { m: 6, t: 10, kala: 'aparahna', type: 'festival', en: 'Vijayadashami (Dasara)', te: 'విజయదశమి (దసరా)', aliases: ['dussehra', 'dasara', 'dasera'] },
45
+ { m: 6, t: 18, kala: 'moonrise', type: 'telugu', en: 'Atla Taddi', te: 'అట్ల తద్దె', aliases: ['atla tadde'] },
46
+ { m: 6, t: 29, kala: 'sunrise', type: 'festival', en: 'Naraka Chaturdashi', te: 'నరక చతుర్దశి' },
47
+ { m: 6, t: 30, kala: 'pradosha', type: 'festival', en: 'Deepavali', te: 'దీపావళి', aliases: ['diwali', 'lakshmi puja'] },
48
+ { m: 7, t: 1, kala: 'sunrise', type: 'telugu', en: 'Karthika Masam begins', te: 'కార్తీక మాసం ప్రారంభం' },
49
+ { m: 7, t: 2, kala: 'sunrise', type: 'festival', en: 'Bhagini Hasta Bhojanam (Bhai Dooj)', te: 'భగినీ హస్త భోజనం', aliases: ['bhai dooj', 'yama dwitiya'] },
50
+ { m: 7, t: 4, kala: 'sunrise', type: 'telugu', en: 'Nagula Chavithi', te: 'నాగుల చవితి' },
51
+ { m: 7, t: 12, kala: 'sunrise', type: 'telugu', en: 'Ksheerabdi Dwadashi', te: 'క్షీరాబ్ది ద్వాదశి' },
52
+ { m: 7, t: 15, kala: 'pradosha', type: 'festival', en: 'Karthika Pournami', te: 'కార్తీక పౌర్ణమి', aliases: ['kartik purnima', 'dev deepavali'] },
53
+ { m: 7, t: 15, kala: 'sunrise', type: 'festival', en: 'Guru Nanak Jayanti', te: 'గురునానక్ జయంతి', aliases: ['gurpurab'] },
54
+ { m: 8, t: 6, kala: 'sunrise', type: 'telugu', en: 'Subrahmanya Shashti', te: 'సుబ్రహ్మణ్య షష్ఠి', aliases: ['skanda shashti'] },
55
+ { m: 8, t: 11, kala: 'sunrise', type: 'festival', en: 'Gita Jayanti', te: 'గీతా జయంతి' },
56
+ { m: 8, t: 15, kala: 'pradosha', type: 'festival', en: 'Dattatreya Jayanti', te: 'దత్తాత్రేయ జయంతి', aliases: ['datta jayanti'] },
57
+ { m: 10, t: 5, kala: 'sunrise', type: 'festival', en: 'Sri Panchami (Vasant Panchami)', te: 'శ్రీ పంచమి', aliases: ['vasant panchami', 'saraswati puja'] },
58
+ { m: 10, t: 7, kala: 'sunrise', type: 'festival', en: 'Ratha Saptami', te: 'రథ సప్తమి', aliases: ['surya jayanti'] },
59
+ { m: 10, t: 8, kala: 'sunrise', type: 'telugu', en: 'Bhishma Ashtami', te: 'భీష్మాష్టమి' },
60
+ { m: 10, t: 11, kala: 'sunrise', type: 'telugu', en: 'Bhishma Ekadashi', te: 'భీష్మ ఏకాదశి' },
61
+ { m: 10, t: 29, kala: 'nishita', type: 'festival', en: 'Maha Shivaratri', te: 'మహా శివరాత్రి', aliases: ['shivratri', 'sivaratri'] },
62
+ { m: 11, t: 15, kala: 'pradosha', type: 'festival', en: 'Holika Dahan (Kama Dahanam)', te: 'కామ దహనం', aliases: ['holika'] },
63
+ ];
64
+
65
+ // Ekadashi names by amanta month: [shukla, bahula].
66
+ const EKADASHI = [
67
+ ['Kamada', 'Varuthini'], ['Mohini', 'Apara'], ['Nirjala', 'Yogini'], ['Devshayani', 'Kamika'],
68
+ ['Shravana Putrada', 'Aja'], ['Parivartini', 'Indira'], ['Papankusha', 'Rama'],
69
+ ['Prabodhini (Utthana)', 'Utpanna'], ['Mokshada', 'Saphala'], ['Pausha Putrada', 'Shattila'],
70
+ ['Jaya', 'Vijaya'], ['Amalaki', 'Papmochani'],
71
+ ];
72
+
73
+ // Fixed Gregorian-date days: [month, day, type, en, te]
74
+ const FIXED = [
75
+ [1, 1, 'intl', "New Year's Day", 'నూతన సంవత్సరం'],
76
+ [1, 12, 'observance', 'National Youth Day (Vivekananda Jayanti)', 'జాతీయ యువజన దినోత్సవం'],
77
+ [1, 23, 'observance', 'Netaji Subhas Chandra Bose Jayanti', 'నేతాజీ జయంతి'],
78
+ [1, 26, 'national', 'Republic Day', 'గణతంత్ర దినోత్సవం'],
79
+ [1, 30, 'observance', "Martyrs' Day", 'అమరవీరుల దినోత్సవం'],
80
+ [2, 14, 'intl', "Valentine's Day", 'ప్రేమికుల దినోత్సవం'],
81
+ [2, 28, 'observance', 'National Science Day', 'జాతీయ విజ్ఞాన దినోత్సవం'],
82
+ [3, 8, 'intl', "International Women's Day", 'అంతర్జాతీయ మహిళా దినోత్సవం'],
83
+ [4, 14, 'national', 'Dr. B.R. Ambedkar Jayanti', 'అంబేద్కర్ జయంతి'],
84
+ [4, 22, 'intl', 'Earth Day', 'ధరిత్రీ దినోత్సవం'],
85
+ [5, 1, 'intl', "May Day (International Workers' Day)", 'మే డే (కార్మిక దినోత్సవం)'],
86
+ [6, 2, 'state', 'Telangana Formation Day', 'తెలంగాణ ఆవిర్భావ దినోత్సవం'],
87
+ [6, 5, 'intl', 'World Environment Day', 'ప్రపంచ పర్యావరణ దినోత్సవం'],
88
+ [6, 21, 'intl', 'International Yoga Day', 'అంతర్జాతీయ యోగా దినోత్సవం'],
89
+ [8, 15, 'national', 'Independence Day', 'స్వాతంత్ర్య దినోత్సవం'],
90
+ [8, 29, 'observance', 'Telugu Language Day (Gidugu Jayanti)', 'తెలుగు భాషా దినోత్సవం'],
91
+ [9, 5, 'observance', "Teachers' Day", 'ఉపాధ్యాయ దినోత్సవం'],
92
+ [9, 15, 'observance', "Engineers' Day", 'ఇంజనీర్ల దినోత్సవం'],
93
+ [10, 2, 'national', 'Gandhi Jayanti', 'గాంధీ జయంతి'],
94
+ [10, 31, 'intl', 'Halloween', 'హాలోవీన్'],
95
+ [11, 1, 'state', 'Andhra Pradesh Formation Day', 'ఆంధ్రప్రదేశ్ అవతరణ దినోత్సవం'],
96
+ [11, 14, 'observance', "Children's Day", 'బాలల దినోత్సవం'],
97
+ [12, 24, 'christian', 'Christmas Eve', 'క్రిస్మస్ ఈవ్'],
98
+ [12, 25, 'christian', 'Christmas', 'క్రిస్మస్'],
99
+ [12, 31, 'intl', "New Year's Eve", 'సంవత్సరాంతం'],
100
+ ];
101
+
102
+ function easter(Y) {
103
+ const a = Y % 19, b = Math.floor(Y / 100), c = Y % 100, d = Math.floor(b / 4), e = b % 4;
104
+ const f = Math.floor((b + 8) / 25), g = Math.floor((b - f + 1) / 3);
105
+ const h = (19 * a + b - d - g + 15) % 30, i = Math.floor(c / 4), k = c % 4;
106
+ const l = (32 + 2 * e + 2 * i - h - k) % 7, m = Math.floor((a + 11 * h + 22 * l) / 451);
107
+ const month = Math.floor((h + l - 7 * m + 114) / 31), day = ((h + l - 7 * m + 114) % 31) + 1;
108
+ return T.dayNum(Y, month, day);
109
+ }
110
+
111
+ /** n-th (1-based; -1 = last) weekday wd (0 = Sun) of a month. */
112
+ function nthWeekday(Y, M, wd, n) {
113
+ if (n > 0) {
114
+ const first = T.dayNum(Y, M, 1);
115
+ return first + ((wd - T.weekday(first) + 7) % 7) + (n - 1) * 7;
116
+ }
117
+ const last = T.dayNum(Y, M + 1, 1) - 1;
118
+ return last - ((T.weekday(last) - wd + 7) % 7);
119
+ }
120
+
121
+ // ---- Islamic calendar: tabular estimate refined with an astronomical crescent-visibility test ----
122
+ const ISL_EPOCH = 1948439.5;
123
+ const islToJd = (y, m, d) => d + Math.ceil(29.5 * (m - 1)) + (y - 1) * 354 + Math.floor((3 + 11 * y) / 30) + ISL_EPOCH - 1;
124
+ const jdToIslYear = (jd) => Math.floor((30 * (Math.floor(jd) + 0.5 - ISL_EPOCH) + 10646) / 10631);
125
+
126
+ /** Civil day number of 1st of Hijri month (y, m) at the observer's location. */
127
+ function hijriMonthStart(cal, y, m) {
128
+ const tab = new Date((islToJd(y, m, 1) - 2440587.5) * DAY);
129
+ const conj = astro.searchPhase(0, new Date(tab.getTime() - 4 * DAY), 8);
130
+ for (let d = cal.dayOf(conj); d < cal.dayOf(conj) + 4; d++) {
131
+ const ss = cal.sunset(d);
132
+ if (ss <= conj) continue;
133
+ const ageH = (ss - conj) / 3600000;
134
+ const moonset = astro.riseSet(A.Body.Moon, cal.observer, -1, ss, 1);
135
+ const lagMin = moonset ? (moonset - ss) / 60000 : 0;
136
+ if (ageH >= 15 && lagMin >= 40) return d + 1; // crescent seen this evening -> next day is the 1st
137
+ }
138
+ return cal.dayOf(conj) + 3;
139
+ }
140
+
141
+ function islamicEvents(cal, Y) {
142
+ const out = [];
143
+ const jd0 = T.dayNum(Y, 1, 1) + 2440587.5;
144
+ const items = [
145
+ [1, 1, 'Islamic New Year (Hijri)', 'ఇస్లామిక్ నూతన సంవత్సరం', 'observance'],
146
+ [1, 10, 'Muharram (Ashura)', 'మొహర్రం', 'islamic'],
147
+ [3, 12, 'Milad-un-Nabi', 'మిలాద్-ఉన్-నబీ', 'islamic'],
148
+ [9, 1, 'Ramzan fasting begins', 'రంజాన్ ఉపవాసాలు ప్రారంభం', 'observance'],
149
+ [10, 1, 'Eid ul-Fitr (Ramzan)', 'రంజాన్ (ఈద్ ఉల్ ఫితర్)', 'islamic'],
150
+ [12, 10, 'Eid ul-Adha (Bakrid)', 'బక్రీద్ (ఈద్ ఉల్ అద్హా)', 'islamic'],
151
+ ];
152
+ for (let hy = jdToIslYear(jd0) - 1; hy <= jdToIslYear(jd0 + 366) + 1; hy++) {
153
+ for (const [m, d, en, te, type] of items) {
154
+ const dn = hijriMonthStart(cal, hy, m) + d - 1;
155
+ if (T.ymd(dn).y === Y) out.push({ dn, type, en, te, note: `${d} ${['Muharram', 'Safar', 'Rabi al-Awwal', '', '', '', '', '', 'Ramadan', 'Shawwal', '', 'Dhu al-Hijjah'][m - 1]} ${hy} AH; subject to moon sighting` });
156
+ }
157
+ }
158
+ return out;
159
+ }
160
+
161
+ function chineseNewYear(Y) {
162
+ const sol = A.Seasons(Y - 1).dec_solstice.date;
163
+ const cn = (d) => T.dayOf(d, 'Asia/Shanghai');
164
+ const solDay = cn(sol);
165
+ let t = new Date(sol.getTime() - 2 * DAY), count = 0;
166
+ while (true) {
167
+ const nm = astro.searchPhase(0, t, 35);
168
+ if (cn(nm) > solDay && ++count === 2) return cn(nm);
169
+ t = new Date(nm.getTime() + DAY);
170
+ }
171
+ }
172
+
173
+ function eclipses(cal, Y) {
174
+ const out = [];
175
+ const from = new Date(Date.UTC(Y, 0, 1) - 2 * DAY), to = new Date(Date.UTC(Y + 1, 0, 1) + 2 * DAY);
176
+ const place = cal.loc.name;
177
+ for (let e = A.SearchLunarEclipse(from); e.peak.date < to; e = A.NextLunarEclipse(e.peak)) {
178
+ const peak = e.peak.date;
179
+ const half = (e.sd_partial || e.sd_penum) * 60000;
180
+ let up = 0, n = 0;
181
+ for (let ms = peak - half; ms <= peak.getTime() + half; ms += 5 * 60000, n++) {
182
+ const d = new Date(ms);
183
+ if (A.Horizon(d, cal.observer, ...radec(A.Body.Moon, d, cal.observer)).altitude > 0) up++;
184
+ }
185
+ const visible = up === 0 ? 'not visible' : up === n ? 'visible' : 'partly visible';
186
+ out.push({
187
+ dn: cal.dayOf(peak), type: 'astro', grid: true, en: `${cap(e.kind)} Lunar Eclipse (Chandra Grahanam)`, te: 'చంద్ర గ్రహణం',
188
+ time: peak, note: `peak ${cal.hm(peak)}; ${visible} in ${place}`,
189
+ });
190
+ }
191
+ for (let e = A.SearchGlobalSolarEclipse(from); e.peak.date < to; e = A.NextGlobalSolarEclipse(e.peak)) {
192
+ const peak = e.peak.date;
193
+ let visible = false;
194
+ try {
195
+ const l = A.SearchLocalSolarEclipse(new Date(peak.getTime() - 2 * DAY), cal.observer);
196
+ visible = Math.abs(l.peak.time.date - peak) < 2 * DAY && l.peak.altitude > 0;
197
+ } catch { /* no local eclipse */ }
198
+ out.push({
199
+ dn: cal.dayOf(peak), type: 'astro', grid: true, en: `${cap(e.kind)} Solar Eclipse (Surya Grahanam)`, te: 'సూర్య గ్రహణం',
200
+ time: peak, note: `peak ${cal.hm(peak)}; ${visible ? 'visible' : 'not visible'} in ${place}`,
201
+ });
202
+ }
203
+ return out.filter((x) => T.ymd(x.dn).y === Y);
204
+ }
205
+ function radec(body, date, observer) {
206
+ const eq = A.Equator(body, date, observer, true, true);
207
+ return [eq.ra, eq.dec, 'normal'];
208
+ }
209
+ const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
210
+
211
+ /** All events for Gregorian year Y. */
212
+ function eventsForYear(cal, Y) {
213
+ const ev = [];
214
+ const inYear = (dn) => T.ymd(dn).y === Y;
215
+ const add = (e) => { if (inYear(e.dn)) ev.push(e); };
216
+ const months = cal.monthsForYear(Y);
217
+
218
+ // Lunar-tithi festivals (celebrated in the nija month only).
219
+ for (const m of months) {
220
+ if (m.adhika) continue;
221
+ for (const f of LUNAR) {
222
+ if (f.m !== m.idx) continue;
223
+ const span = cal.tithiSpan(m, f.t);
224
+ add({ dn: cal.pickDay(span, f.kala), type: f.type, en: f.en, te: f.te, aliases: f.aliases });
225
+ }
226
+ }
227
+
228
+ // Holi: the day after Holika Dahan.
229
+ for (const e of [...ev]) if (e.en.startsWith('Holika')) add({ dn: e.dn + 1, type: 'festival', en: 'Holi', te: 'హోళీ', aliases: ['holi'] });
230
+
231
+ // Varalakshmi Vratam: the Friday on or before Shravana Pournami (Shukla paksha).
232
+ for (const e of [...ev]) {
233
+ if (!e.en.startsWith('Raksha')) continue;
234
+ let d = e.dn;
235
+ while (T.weekday(d) !== 5) d--;
236
+ add({ dn: d, type: 'telugu', en: 'Varalakshmi Vratam', te: 'వరలక్ష్మీ వ్రతం' });
237
+ }
238
+
239
+ // Monthly: Ekadashi, Pradosham, Masa Shivaratri, Sankashti, Pournami, Amavasya, Karthika Somavaram.
240
+ for (const m of months) {
241
+ const mName = (m.adhika ? 'Adhika ' : '') + m.name.en;
242
+ const mTe = (m.adhika ? 'అధిక ' : '') + m.name.te;
243
+ [11, 26].forEach((t, i) => {
244
+ const span = cal.tithiSpan(m, t);
245
+ const dn = cal.pickDay(span, 'sunrise');
246
+ const nm = m.adhika ? (i === 0 ? 'Padmini' : 'Parama') : EKADASHI[m.idx][i];
247
+ const sunInDhanu = Math.floor(astro.sunSidereal(span.start) / 30) === 8;
248
+ if (t === 11 && sunInDhanu) {
249
+ add({ dn, type: 'festival', en: 'Vaikuntha Ekadashi (Mukkoti Ekadashi)', te: 'వైకుంఠ ఏకాదశి (ముక్కోటి ఏకాదశి)', aliases: ['mukkoti', 'vaikunta'] });
250
+ }
251
+ add({ dn, type: 'vrata', en: `${nm} Ekadashi`, te: 'ఏకాదశి' });
252
+ });
253
+ for (const t of [13, 28]) add({ dn: cal.pickDay(cal.tithiSpan(m, t), 'pradosha'), type: 'vrata', en: 'Pradosham', te: 'ప్రదోషం' });
254
+ if (!(m.idx === 10 && !m.adhika)) add({ dn: cal.pickDay(cal.tithiSpan(m, 29), 'nishita'), type: 'vrata', en: 'Masa Shivaratri', te: 'మాస శివరాత్రి' });
255
+ add({ dn: cal.pickDay(cal.tithiSpan(m, 19), 'moonrise'), type: 'vrata', en: 'Sankashti Chaturthi', te: 'సంకష్టహర చతుర్థి' });
256
+
257
+ // Pournami tithi = elongation 168°–180°, Amavasya = 348°–360°; each ends at the exact full/new moon.
258
+ const full = astro.searchPhase(180, m.start, 20);
259
+ const pStart = cal.tithiSpan(m, 15).start;
260
+ const aStart = cal.tithiSpan(m, 30).start;
261
+ const tithiNote = (label, start, end, moon) => {
262
+ const dn = cal.dayOf(end);
263
+ return { dn, tithiStart: start, note: `${label} tithi ${cal.hm(start, dn)} – ${cal.hm(end, dn)}; ${moon} at ${cal.hm(end)}` };
264
+ };
265
+ add({ type: 'astro', moon: 'full', time: full, en: `${mName} Pournami (Full Moon)`, te: `${mTe} పౌర్ణమి`, ...tithiNote('Pournami', pStart, full, 'full moon') });
266
+ add({ type: 'astro', moon: 'new', time: m.end, en: `${mName} Amavasya (New Moon)`, te: `${mTe} అమావాస్య`, ...tithiNote('Amavasya', aStart, m.end, 'new moon') });
267
+
268
+ if (m.idx === 7 && !m.adhika) {
269
+ for (let d = cal.dayOf(m.start); d <= cal.dayOf(m.end); d++) {
270
+ if (T.weekday(d) === 1 && cal.lunarMonthAt(cal.sunrise(d)) === m) add({ dn: d, type: 'vrata', en: 'Karthika Somavaram', te: 'కార్తీక సోమవారం' });
271
+ }
272
+ }
273
+ }
274
+
275
+ // Solar ingresses (sankranti). Observed on the day of ingress, or the next day if after sunset.
276
+ let t = new Date(Date.UTC(Y, 0, 1) - 20 * DAY);
277
+ for (let i = 0; i < 14; i++) {
278
+ const r = (Math.floor(astro.sunSidereal(t) / 30) + 1) % 12;
279
+ const when = astro.sankrantiAfter(r * 30, t);
280
+ t = new Date(when.getTime() + DAY);
281
+ let dn = cal.dayOf(when);
282
+ if (when > cal.sunset(dn)) dn += 1;
283
+ const rashi = N.RASHIS[r];
284
+ const note = `Sun enters ${rashi.en} at ${cal.hm(when, dn)}`;
285
+ if (r === 9) {
286
+ add({ dn: dn - 1, type: 'telugu', en: 'Bhogi', te: 'భోగి', aliases: ['bhogi'] });
287
+ add({ dn: dn - 1, type: 'festival', en: 'Lohri', te: 'లోహ్రి' });
288
+ add({ dn, type: 'telugu', grid: true, en: 'Makara Sankranti (Pongal)', te: 'మకర సంక్రాంతి', aliases: ['sankranthi', 'pongal', 'uttarayan'], note });
289
+ add({ dn: dn + 1, type: 'telugu', en: 'Kanuma', te: 'కనుమ' });
290
+ add({ dn: dn + 2, type: 'telugu', en: 'Mukkanuma', te: 'ముక్కనుమ' });
291
+ } else {
292
+ add({ dn, type: 'astro', en: `${rashi.en} Sankranti`, te: `${rashi.te} సంక్రమణం`, note });
293
+ if (r === 0) add({ dn, type: 'festival', en: 'Vishu / Puthandu / Baisakhi', te: 'విషు / పుత్తాండు / వైశాఖి' });
294
+ }
295
+ }
296
+
297
+ // Gregorian fixed & computed.
298
+ for (const [M, D, type, en, te] of FIXED) add({ dn: T.dayNum(Y, M, D), type, en, te });
299
+ const ea = easter(Y);
300
+ add({ dn: ea - 46, type: 'christian', en: 'Ash Wednesday', te: 'యాష్ వెడ్నెస్డే' });
301
+ add({ dn: ea - 2, type: 'christian', en: 'Good Friday', te: 'గుడ్ ఫ్రైడే' });
302
+ add({ dn: ea, type: 'christian', en: 'Easter Sunday', te: 'ఈస్టర్' });
303
+ add({ dn: nthWeekday(Y, 5, 0, 2), type: 'intl', en: "Mother's Day", te: 'మాతృ దినోత్సవం' });
304
+ add({ dn: nthWeekday(Y, 6, 0, 3), type: 'intl', en: "Father's Day", te: 'పితృ దినోత్సవం' });
305
+ add({ dn: nthWeekday(Y, 8, 0, 1), type: 'intl', en: 'Friendship Day', te: 'స్నేహితుల దినోత్సవం' });
306
+ add({ dn: nthWeekday(Y, 11, 4, 4), type: 'intl', en: 'Thanksgiving (USA)', te: 'థాంక్స్ గివింగ్' });
307
+ add({ dn: nthWeekday(Y, 9, 1, 1), type: 'intl', en: 'Labor Day (USA)', te: 'లేబర్ డే (అమెరికా)' });
308
+ add({ dn: nthWeekday(Y, 5, 1, -1), type: 'intl', en: 'Memorial Day (USA)', te: 'మెమోరియల్ డే (అమెరికా)' });
309
+ add({ dn: chineseNewYear(Y), type: 'intl', en: 'Chinese / Lunar New Year', te: 'చైనీస్ నూతన సంవత్సరం' });
310
+
311
+ ev.push(...islamicEvents(cal, Y));
312
+ ev.push(...eclipses(cal, Y));
313
+
314
+ const ORDER = ['national', 'festival', 'telugu', 'islamic', 'christian', 'state', 'intl', 'astro', 'observance', 'vrata'];
315
+ ev.sort((a, b) => a.dn - b.dn || ORDER.indexOf(a.type) - ORDER.indexOf(b.type));
316
+ return ev;
317
+ }
318
+
319
+ const MAJOR_TYPES = new Set(['festival', 'telugu', 'national', 'state', 'islamic', 'christian', 'intl']);
320
+ const isMajor = (e) => MAJOR_TYPES.has(e.type) || e.grid || (e.type === 'astro' && /Grahanam/.test(e.en));
321
+
322
+ module.exports = { eventsForYear, isMajor };
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+ // Preset cities. Any place can also be given with --lat --lon --tz.
3
+
4
+ const IST = 'Asia/Kolkata';
5
+ const c = (name, lat, lon, tz = IST, aliases = []) => ({ name, lat, lon, tz, aliases });
6
+
7
+ const CITIES = {
8
+ // Telangana
9
+ hyderabad: c('Hyderabad', 17.385, 78.4867, IST, ['secunderabad', 'hyd']),
10
+ warangal: c('Warangal', 17.9689, 79.5941),
11
+ karimnagar: c('Karimnagar', 18.4386, 79.1288),
12
+ nizamabad: c('Nizamabad', 18.6725, 78.0941),
13
+ khammam: c('Khammam', 17.2473, 80.1514),
14
+ // Andhra Pradesh
15
+ vijayawada: c('Vijayawada', 16.5062, 80.648, IST, ['bezawada']),
16
+ amaravati: c('Amaravati', 16.5131, 80.5165),
17
+ visakhapatnam: c('Visakhapatnam', 17.6868, 83.2185, IST, ['vizag', 'vishakapatnam']),
18
+ tirupati: c('Tirupati', 13.6288, 79.4192),
19
+ guntur: c('Guntur', 16.3067, 80.4365),
20
+ nellore: c('Nellore', 14.4426, 79.9865),
21
+ kurnool: c('Kurnool', 15.8281, 78.0373),
22
+ rajahmundry: c('Rajahmundry', 17.0005, 81.804, IST, ['rajamahendravaram']),
23
+ kakinada: c('Kakinada', 16.9891, 82.2475),
24
+ kadapa: c('Kadapa', 14.4673, 78.8242),
25
+ anantapur: c('Anantapur', 14.6819, 77.6006),
26
+ srikakulam: c('Srikakulam', 18.2949, 83.8938),
27
+ ongole: c('Ongole', 15.5057, 80.0499),
28
+ // Rest of India
29
+ bengaluru: c('Bengaluru', 12.9716, 77.5946, IST, ['bangalore']),
30
+ chennai: c('Chennai', 13.0827, 80.2707, IST, ['madras']),
31
+ mumbai: c('Mumbai', 19.076, 72.8777, IST, ['bombay']),
32
+ pune: c('Pune', 18.5204, 73.8567),
33
+ delhi: c('New Delhi', 28.6139, 77.209, IST, ['new-delhi']),
34
+ kolkata: c('Kolkata', 22.5726, 88.3639),
35
+ // Abroad
36
+ 'new-york': c('New York', 40.7128, -74.006, 'America/New_York', ['nyc', 'newyork']),
37
+ 'new-jersey': c('Edison, NJ', 40.5187, -74.4121, 'America/New_York', ['edison', 'nj']),
38
+ atlanta: c('Atlanta', 33.749, -84.388, 'America/New_York'),
39
+ chicago: c('Chicago', 41.8781, -87.6298, 'America/Chicago'),
40
+ dallas: c('Dallas', 32.7767, -96.797, 'America/Chicago'),
41
+ houston: c('Houston', 29.7604, -95.3698, 'America/Chicago'),
42
+ 'san-francisco': c('San Francisco Bay Area', 37.7749, -122.4194, 'America/Los_Angeles', ['bay-area', 'sf', 'san-jose']),
43
+ seattle: c('Seattle', 47.6062, -122.3321, 'America/Los_Angeles'),
44
+ toronto: c('Toronto', 43.6532, -79.3832, 'America/Toronto'),
45
+ london: c('London', 51.5074, -0.1278, 'Europe/London'),
46
+ dubai: c('Dubai', 25.2048, 55.2708, 'Asia/Dubai'),
47
+ singapore: c('Singapore', 1.3521, 103.8198, 'Asia/Singapore'),
48
+ sydney: c('Sydney', -33.8688, 151.2093, 'Australia/Sydney'),
49
+ melbourne: c('Melbourne', -37.8136, 144.9631, 'Australia/Melbourne'),
50
+ auckland: c('Auckland', -36.8485, 174.7633, 'Pacific/Auckland'),
51
+ };
52
+
53
+ function findCity(q) {
54
+ if (!q) return null;
55
+ const k = String(q).toLowerCase().trim().replace(/[\s_]+/g, '-');
56
+ if (CITIES[k]) return CITIES[k];
57
+ for (const city of Object.values(CITIES)) if (city.aliases.includes(k)) return city;
58
+ return null;
59
+ }
60
+
61
+ module.exports = { CITIES, findCity, DEFAULT_CITY: 'hyderabad' };
package/src/names.js ADDED
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+ // English (Telugu-style transliteration) and Telugu-script names.
3
+
4
+ const pair = (en, te) => ({ en, te });
5
+
6
+ const MONTHS = [
7
+ pair('Chaitra', 'చైత్ర'), pair('Vaishakha', 'వైశాఖ'), pair('Jyeshtha', 'జ్యేష్ఠ'),
8
+ pair('Ashadha', 'ఆషాఢ'), pair('Shravana', 'శ్రావణ'), pair('Bhadrapada', 'భాద్రపద'),
9
+ pair('Ashvayuja', 'ఆశ్వయుజ'), pair('Karthika', 'కార్తీక'), pair('Margashira', 'మార్గశిర'),
10
+ pair('Pushya', 'పుష్య'), pair('Magha', 'మాఘ'), pair('Phalguna', 'ఫాల్గుణ'),
11
+ ];
12
+
13
+ const TITHIS = [
14
+ pair('Padyami', 'పాడ్యమి'), pair('Vidiya', 'విదియ'), pair('Tadiya', 'తదియ'),
15
+ pair('Chavithi', 'చవితి'), pair('Panchami', 'పంచమి'), pair('Shashti', 'షష్ఠి'),
16
+ pair('Saptami', 'సప్తమి'), pair('Ashtami', 'అష్టమి'), pair('Navami', 'నవమి'),
17
+ pair('Dashami', 'దశమి'), pair('Ekadashi', 'ఏకాదశి'), pair('Dwadashi', 'ద్వాదశి'),
18
+ pair('Trayodashi', 'త్రయోదశి'), pair('Chaturdashi', 'చతుర్దశి'),
19
+ ];
20
+ const PURNIMA = pair('Pournami', 'పౌర్ణమి');
21
+ const AMAVASYA = pair('Amavasya', 'అమావాస్య');
22
+
23
+ const PAKSHA = [pair('Shukla', 'శుక్ల'), pair('Bahula', 'బహుళ')];
24
+
25
+ const VARAS = [
26
+ pair('Aadivaram', 'ఆదివారం'), pair('Somavaram', 'సోమవారం'), pair('Mangalavaram', 'మంగళవారం'),
27
+ pair('Budhavaram', 'బుధవారం'), pair('Guruvaram', 'గురువారం'), pair('Shukravaram', 'శుక్రవారం'),
28
+ pair('Shanivaram', 'శనివారం'),
29
+ ];
30
+
31
+ const NAKSHATRAS = [
32
+ pair('Ashwini', 'అశ్విని'), pair('Bharani', 'భరణి'), pair('Krittika', 'కృత్తిక'),
33
+ pair('Rohini', 'రోహిణి'), pair('Mrigashira', 'మృగశిర'), pair('Ardra', 'ఆర్ద్ర'),
34
+ pair('Punarvasu', 'పునర్వసు'), pair('Pushyami', 'పుష్యమి'), pair('Ashlesha', 'ఆశ్లేష'),
35
+ pair('Makha', 'మఖ'), pair('Pubba', 'పుబ్బ'), pair('Uttara', 'ఉత్తర'),
36
+ pair('Hasta', 'హస్త'), pair('Chitta', 'చిత్త'), pair('Swati', 'స్వాతి'),
37
+ pair('Vishakha', 'విశాఖ'), pair('Anuradha', 'అనూరాధ'), pair('Jyeshtha', 'జ్యేష్ఠ'),
38
+ pair('Moola', 'మూల'), pair('Purvashadha', 'పూర్వాషాఢ'), pair('Uttarashadha', 'ఉత్తరాషాఢ'),
39
+ pair('Shravanam', 'శ్రవణం'), pair('Dhanishta', 'ధనిష్ఠ'), pair('Shatabhisham', 'శతభిషం'),
40
+ pair('Purvabhadra', 'పూర్వాభాద్ర'), pair('Uttarabhadra', 'ఉత్తరాభాద్ర'), pair('Revati', 'రేవతి'),
41
+ ];
42
+
43
+ const YOGAS = [
44
+ pair('Vishkambha', 'విష్కంభం'), pair('Priti', 'ప్రీతి'), pair('Ayushman', 'ఆయుష్మాన్'),
45
+ pair('Saubhagya', 'సౌభాగ్యం'), pair('Shobhana', 'శోభన'), pair('Atiganda', 'అతిగండ'),
46
+ pair('Sukarma', 'సుకర్మ'), pair('Dhriti', 'ధృతి'), pair('Shoola', 'శూల'),
47
+ pair('Ganda', 'గండ'), pair('Vriddhi', 'వృద్ధి'), pair('Dhruva', 'ధ్రువ'),
48
+ pair('Vyaghata', 'వ్యాఘాత'), pair('Harshana', 'హర్షణ'), pair('Vajra', 'వజ్ర'),
49
+ pair('Siddhi', 'సిద్ధి'), pair('Vyatipata', 'వ్యతీపాత'), pair('Variyan', 'వరీయాన్'),
50
+ pair('Parigha', 'పరిఘ'), pair('Shiva', 'శివ'), pair('Siddha', 'సిద్ధ'),
51
+ pair('Sadhya', 'సాధ్య'), pair('Shubha', 'శుభ'), pair('Shukla', 'శుక్ల'),
52
+ pair('Brahma', 'బ్రహ్మ'), pair('Aindra', 'ఐంద్ర'), pair('Vaidhriti', 'వైధృతి'),
53
+ ];
54
+
55
+ const KARANAS_MOVABLE = [
56
+ pair('Bava', 'బవ'), pair('Balava', 'బాలవ'), pair('Kaulava', 'కౌలవ'), pair('Taitila', 'తైతుల'),
57
+ pair('Garaja', 'గరజ'), pair('Vanija', 'వణిజ'), pair('Vishti (Bhadra)', 'విష్టి (భద్ర)'),
58
+ ];
59
+ const KARANAS_FIXED = {
60
+ 0: pair('Kimstughna', 'కింస్తుఘ్నం'),
61
+ 57: pair('Shakuni', 'శకుని'),
62
+ 58: pair('Chatushpada', 'చతుష్పాద'),
63
+ 59: pair('Nagava', 'నాగవం'),
64
+ };
65
+
66
+ const RASHIS = [
67
+ pair('Mesha', 'మేష'), pair('Vrishabha', 'వృషభ'), pair('Mithuna', 'మిథున'),
68
+ pair('Karkataka', 'కర్కాటక'), pair('Simha', 'సింహ'), pair('Kanya', 'కన్య'),
69
+ pair('Tula', 'తుల'), pair('Vrischika', 'వృశ్చిక'), pair('Dhanu', 'ధనుస్సు'),
70
+ pair('Makara', 'మకర'), pair('Kumbha', 'కుంభ'), pair('Meena', 'మీన'),
71
+ ];
72
+
73
+ const RITUS = [
74
+ pair('Vasanta', 'వసంత'), pair('Grishma', 'గ్రీష్మ'), pair('Varsha', 'వర్ష'),
75
+ pair('Sharad', 'శరద్'), pair('Hemanta', 'హేమంత'), pair('Shishira', 'శిశిర'),
76
+ ];
77
+
78
+ const AYANAS = [pair('Uttarayanam', 'ఉత్తరాయణం'), pair('Dakshinayanam', 'దక్షిణాయనం')];
79
+
80
+ const SAMVATSARAS = [
81
+ ['Prabhava', 'ప్రభవ'], ['Vibhava', 'విభవ'], ['Shukla', 'శుక్ల'], ['Pramoduta', 'ప్రమోదూత'],
82
+ ['Prajotpatti', 'ప్రజోత్పత్తి'], ['Angirasa', 'ఆంగీరస'], ['Shrimukha', 'శ్రీముఖ'], ['Bhava', 'భావ'],
83
+ ['Yuva', 'యువ'], ['Dhatu', 'ధాత'], ['Ishvara', 'ఈశ్వర'], ['Bahudhanya', 'బహుధాన్య'],
84
+ ['Pramathi', 'ప్రమాది'], ['Vikrama', 'విక్రమ'], ['Vrusha', 'వృష'], ['Chitrabhanu', 'చిత్రభాను'],
85
+ ['Svabhanu', 'స్వభాను'], ['Tarana', 'తారణ'], ['Parthiva', 'పార్థివ'], ['Vyaya', 'వ్యయ'],
86
+ ['Sarvajit', 'సర్వజిత్'], ['Sarvadhari', 'సర్వధారి'], ['Virodhi', 'విరోధి'], ['Vikruti', 'వికృతి'],
87
+ ['Khara', 'ఖర'], ['Nandana', 'నందన'], ['Vijaya', 'విజయ'], ['Jaya', 'జయ'],
88
+ ['Manmatha', 'మన్మథ'], ['Durmukhi', 'దుర్ముఖి'], ['Hevilambi', 'హేవిళంబి'], ['Vilambi', 'విళంబి'],
89
+ ['Vikari', 'వికారి'], ['Sharvari', 'శార్వరి'], ['Plava', 'ప్లవ'], ['Shubhakrut', 'శుభకృత్'],
90
+ ['Shobhakrut', 'శోభకృత్'], ['Krodhi', 'క్రోధి'], ['Vishvavasu', 'విశ్వావసు'], ['Parabhava', 'పరాభవ'],
91
+ ['Plavanga', 'ప్లవంగ'], ['Kilaka', 'కీలక'], ['Saumya', 'సౌమ్య'], ['Sadharana', 'సాధారణ'],
92
+ ['Virodhikrut', 'విరోధికృత్'], ['Paridhavi', 'పరీధావి'], ['Pramadicha', 'ప్రమాదీచ'], ['Ananda', 'ఆనంద'],
93
+ ['Rakshasa', 'రాక్షస'], ['Nala', 'నల'], ['Pingala', 'పింగళ'], ['Kalayukti', 'కాళయుక్తి'],
94
+ ['Siddharthi', 'సిద్ధార్థి'], ['Raudri', 'రౌద్రి'], ['Durmati', 'దుర్మతి'], ['Dundubhi', 'దుందుభి'],
95
+ ['Rudhirodgari', 'రుధిరోద్గారి'], ['Raktakshi', 'రక్తాక్షి'], ['Krodhana', 'క్రోధన'], ['Akshaya', 'అక్షయ'],
96
+ ].map(([en, te]) => pair(en, te));
97
+
98
+ if (SAMVATSARAS.length !== 60) throw new Error('Samvatsara table must have 60 entries');
99
+
100
+ const GREG_MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
101
+ 'August', 'September', 'October', 'November', 'December'];
102
+ const GREG_MONTHS_TE = ['జనవరి', 'ఫిబ్రవరి', 'మార్చి', 'ఏప్రిల్', 'మే', 'జూన్', 'జూలై',
103
+ 'ఆగస్టు', 'సెప్టెంబరు', 'అక్టోబరు', 'నవంబరు', 'డిసెంబరు'];
104
+ const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
105
+
106
+ /** Tithi number 1..30 → { en, te, paksha } */
107
+ function tithiName(n) {
108
+ const paksha = n <= 15 ? 0 : 1;
109
+ const k = (n - 1) % 15; // 0..14
110
+ const base = k === 14 ? (paksha === 0 ? PURNIMA : AMAVASYA) : TITHIS[k];
111
+ return { ...base, paksha: PAKSHA[paksha] };
112
+ }
113
+
114
+ /** Karana index 0..59 within the lunar month */
115
+ function karanaName(k) {
116
+ return KARANAS_FIXED[k] || KARANAS_MOVABLE[(k - 1) % 7];
117
+ }
118
+
119
+ module.exports = {
120
+ MONTHS, TITHIS, PAKSHA, VARAS, NAKSHATRAS, YOGAS, RASHIS, RITUS, AYANAS, SAMVATSARAS,
121
+ GREG_MONTHS, GREG_MONTHS_TE, WEEKDAYS, tithiName, karanaName,
122
+ };