@zemendev/calendar 0.0.0-stage → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Besufkad Mekonnen. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ================================================================================
24
+ THIRD-PARTY ACKNOWLEDGEMENTS
25
+ ================================================================================
26
+
27
+ This software incorporates Bahire Hasab computus logic inspired by:
28
+
29
+ kenat (ቀናት)
30
+ Copyright (c) 2025 Melaku Demeke
31
+ Repository: https://github.com/MelakuDemeke/kenat
32
+ License: MIT
package/README.md CHANGED
@@ -1,3 +1,178 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="https://zemen-universal-ethiopian-gregorian.vercel.app/icon-192.png" width="96" height="96" alt="Zemen Calendar Logo" />
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ # @zemendev/calendar
6
+
7
+ Liturgical computus engine implementing ancient Bahire Hasab (ባሕረ ሃሳብ), Orthodox Tewahedo fasting seasons, 365-day Synaxarium (ስንክሳር) daily saints commemorations, and Ethiopian Islamic holiday calculations.
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@zemendev/calendar.svg)](https://www.npmjs.com/package/@zemendev/calendar)
10
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@zemendev/calendar.svg)](https://bundlephobia.com/package/@zemendev/calendar)
11
+
12
+ [Interactive Computus Inspector](https://zemen-universal-ethiopian-gregorian.vercel.app/docs/liturgical)
13
+
14
+ ---
15
+
16
+ ## Technical Overview
17
+
18
+ The Ethiopian Orthodox Tewahedo Church computus system, known as **Bahire Hasab** (literally *"Sea of Computus"*), was formulated by Demetrius, 12th Patriarch of Alexandria. It determines the movable Christian feasts across centuries based on:
19
+
20
+ 1. **Amete Alem (ዓመተ ዓለም)**: Solar years elapsed from the Annus Mundi creation epoch (5500 BC + Ethiopian year).
21
+ 2. **The 19-Year Metonic Lunar Cycle**: Reconciling the 365.25-day solar year with 29.53-day lunar synodic months via *Wenber* (Golden Number), *Abektie* (lunar epact), and *Metqi* (Paschal full moon day).
22
+ 3. **The 28-Year Solar Cycle**: Determining the weekday of Ethiopian New Year (1 Meskerem) and ruling Evangelist (0 = John, 1 = Matthew, 2 = Mark, 3 = Luke).
23
+ 4. **The Nineveh Anchor**: All 11 movable feasts are mathematically derived as continuous day offsets from the Fast of Nineveh (*Tsome Nenewe*).
24
+
25
+ `@zemendev/calendar` provides a tested TypeScript implementation of these ancient astronomical algorithms, alongside full fasting rules and Synaxarium datasets.
26
+
27
+ ---
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install @zemendev/calendar @zemendev/core
33
+ ```
34
+
35
+ ---
36
+
37
+ ## API Reference & Usage Examples
38
+
39
+ ### 1. Bahire Hasab Computus Calculation
40
+
41
+ Computes astronomical constants, ruling evangelist, and all 11 movable feasts for any Ethiopian calendar year:
42
+
43
+ ```typescript
44
+ import { calculateBahireHasab } from '@zemendev/calendar';
45
+
46
+ const bh = calculateBahireHasab(2017);
47
+
48
+ // Astronomical & Calendar Markers
49
+ console.log('Amete Alem:', bh.ameteAlem); // 7517
50
+ console.log('Ruling Evangelist:', bh.evangelist); // { index: 1, name: { amharic: 'ማቴዎስ', english: 'Matthew' } }
51
+ console.log('New Year Day:', bh.newYearDay); // { index: 3, name: { amharic: 'ረቡዕ', english: 'Wednesday' } }
52
+ console.log('Wenber (Golden Number):', bh.wenber); // 16
53
+ console.log('Abektie (Moon Age):', bh.abektie); // 18
54
+ console.log('Metqi (Paschal Moon):', bh.metqi); // 12
55
+ console.log('Nineveh Anchor Date:', bh.nineveh); // { year: 2017, month: 6, day: 3 } (Yekatit 3, 2017 EC)
56
+
57
+ // Accessing the 11 Movable Feasts
58
+ console.log(bh.feasts.abiyTsome.ethiopian); // { year: 2017, month: 6, day: 17 } (Great Lent)
59
+ console.log(bh.feasts.debreZeit.ethiopian); // { year: 2017, month: 7, day: 14 } (Mount of Olives)
60
+ console.log(bh.feasts.hosanna.ethiopian); // { year: 2017, month: 8, day: 5 } (Palm Sunday)
61
+ console.log(bh.feasts.siklet.ethiopian); // { year: 2017, month: 8, day: 10 } (Good Friday)
62
+ console.log(bh.feasts.fasika.ethiopian); // { year: 2017, month: 8, day: 12 } (Easter Sunday)
63
+ console.log(bh.feasts.erget.ethiopian); // { year: 2017, month: 9, day: 21 } (Ascension)
64
+ console.log(bh.feasts.paraclete.ethiopian); // { year: 2017, month: 10, day: 2 } (Pentecost)
65
+ ```
66
+
67
+ ### Movable Feasts Offset Map
68
+
69
+ All movable feasts are anchored to the Monday of the Fast of Nineveh (`offset = 0`):
70
+
71
+ | Feast Key | Offset | Amharic Name | English Name | Feast Category |
72
+ | :--- | :---: | :--- | :--- | :--- |
73
+ | `nineveh` | `+0` | ጾመ ነነዌ | Fast of Nineveh | Obligatory Fasting (3 Days) |
74
+ | `abiyTsome` | `+14` | ዓቢይ ጾም (ሁዳዴ) | Great Lent | Obligatory Fasting (55 Days) |
75
+ | `debreZeit` | `+41` | ደብረ ዘይት | Mount of Olives | Mid-Lent Sunday |
76
+ | `hosanna` | `+62` | ሆሣዕና | Palm Sunday | Major Feast |
77
+ | `siklet` | `+67` | ስቅለት | Good Friday | Fasting & Public Holiday |
78
+ | `fasika` | `+69` | ትንሣኤ (ፋሲካ) | Easter Sunday | Major Public Holiday |
79
+ | `rikbeKahnat` | `+93` | ርክበ ካህናት | Synod of Priests | Liturgical Wednesday |
80
+ | `erget` | `+108` | ዕርገት | Ascension of Christ | Liturgical Thursday (40 days post-Easter) |
81
+ | `paraclete` | `+118` | ጰራቅሊጦስ | Pentecost | Liturgical Sunday (50 days post-Easter) |
82
+ | `tsomeHawaryat` | `+119` | ጾመ ሐዋርያት | Apostles Fast | Fasting Season (begins post-Pentecost) |
83
+ | `tsomeDihenet` | `+121` | ጾመ ድኅነት | Salvation Fast | Wednesday & Friday Obligatory Fasts |
84
+
85
+ *(Both `debreZeit` / `debrefeyit` and `paraclete` / `paraklitos` aliases are supported).*
86
+
87
+ ---
88
+
89
+ ### 2. Fasting Seasons Detection
90
+
91
+ Evaluates whether any given Ethiopian date is an obligatory or voluntary fasting day:
92
+
93
+ ```typescript
94
+ import { isFastingDay, getActiveFastingPeriod, getFastingPeriod } from '@zemendev/calendar';
95
+
96
+ const testDate = { year: 2017, month: 7, day: 10 }; // Megabit 10, 2017 EC (During Great Lent)
97
+
98
+ const status = isFastingDay(testDate);
99
+ console.log(status.isFasting); // true
100
+ console.log(status.reason); // "ዓቢይ ጾም (ሁዳዴ) - Great Lent"
101
+
102
+ const activePeriod = getActiveFastingPeriod(testDate);
103
+ console.log(activePeriod?.name.english); // "Great Lent"
104
+ console.log(activePeriod?.totalDays); // 55
105
+ console.log(activePeriod?.start); // { year: 2017, month: 6, day: 17 }
106
+ console.log(activePeriod?.end); // { year: 2017, month: 8, day: 11 }
107
+ ```
108
+
109
+ ### 3. Daily Synaxarium Saints Commemorations
110
+
111
+ Provides the Ethiopian Orthodox Church calendar of daily commemorations across the 30-day monthly cycle, with major annual feast (*Negs*) verification:
112
+
113
+ ```typescript
114
+ import { getDailySaints, isMajorAnnualFeast } from '@zemendev/calendar';
115
+
116
+ // Get saints commemorated on the 21st day of every Ethiopian month (St. Mary / ድንግል ማርያም)
117
+ const daySaints = getDailySaints(21);
118
+ console.log(daySaints.map(s => s.name.amharic));
119
+ // ["እግዝእትነ ማርያም", ...]
120
+
121
+ // Check if a specific date is celebrated as a major annual feast (Negs)
122
+ // Hidar 21 is the major annual feast of Saint Mary (ጽዮን ማርያም)
123
+ const hidar21 = { year: 2017, month: 3, day: 21 };
124
+ console.log(isMajorAnnualFeast(hidar21)); // true
125
+ ```
126
+
127
+ ### 4. Ethiopian National Islamic Holidays
128
+
129
+ Calculates approximate dates for the major national Islamic holidays recognized as official Ethiopian public holidays:
130
+
131
+ ```typescript
132
+ import { getIslamicHolidaysForYear } from '@zemendev/calendar';
133
+
134
+ const islamicHolidays = getIslamicHolidaysForYear(2017);
135
+ console.log(islamicHolidays);
136
+ // [
137
+ // { key: 'eid_al_fitr', name: { amharic: 'ዒድ አል ፈጥር', english: 'Eid al-Fitr' }, ethiopian: { year: 2017, month: 7, day: 22 } },
138
+ // { key: 'eid_al_adha', name: { amharic: 'ዒድ አል አድሃ (አረፋ)', english: 'Eid al-Adha (Arefa)' }, ethiopian: { year: 2017, month: 10, day: 29 } },
139
+ // { key: 'mawlid', name: { amharic: 'መውሊድ', english: 'Mawlid al-Nabi' }, ethiopian: { year: 2017, month: 1, day: 5 } }
140
+ // ]
141
+ ```
142
+
143
+ ---
144
+
145
+ ## TypeScript Definitions
146
+
147
+ ```typescript
148
+ export interface LiturgicalHoliday {
149
+ key: string;
150
+ name: { amharic: string; english: string };
151
+ ethiopian: EthiopianDate;
152
+ gregorian: GregorianDate;
153
+ movable: boolean;
154
+ tags: string[];
155
+ }
156
+
157
+ export interface SaintCommemoration {
158
+ id: string;
159
+ name: { amharic: string; english: string };
160
+ description: { amharic: string; english: string };
161
+ major: boolean;
162
+ negs: number[]; // Months in which celebrated as major annual feast
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Upstream Foundations & Acknowledgements
169
+
170
+ The computus formulas and liturgical algorithms implemented in this package are founded on:
171
+
172
+ - **[kenat (ቀናት)](https://github.com/MelakuDemeke/kenat)** by Melaku Demeke: Foundational Bahire Hasab computus formulas and liturgical date arithmetic.
173
+
174
+ ---
175
+
176
+ ## License
177
+
178
+ Copyright (c) 2026 Besufkad Mekonnen. All rights reserved. Private and proprietary.
@@ -0,0 +1,80 @@
1
+ import type { EthiopianDate, GregorianDate } from "@zemendev/core";
2
+ /**
3
+ * Represents a liturgical holiday or movable feast in the Ethiopian Orthodox calendar.
4
+ */
5
+ export interface LiturgicalHoliday {
6
+ /** Unique identifying slug (e.g. 'nineveh', 'fasika', 'siklet') */
7
+ key: string;
8
+ /** Bilingual name in Amharic and English */
9
+ name: {
10
+ amharic: string;
11
+ english: string;
12
+ };
13
+ /** Computed date in the Ethiopian calendar */
14
+ ethiopian: EthiopianDate;
15
+ /** Converted date in the Gregorian calendar */
16
+ gregorian: GregorianDate;
17
+ /** Whether this is a movable feast calculated via computus */
18
+ movable: boolean;
19
+ /** Categorization tags (e.g. ['religious', 'christian', 'fasting']) */
20
+ tags: string[];
21
+ }
22
+ /**
23
+ * Complete computus result containing all 11 movable feasts, evangelist, and astronomical markers
24
+ * calculated via Bahire Hasab (ባሕረ ሃሳብ) for an Ethiopian year.
25
+ */
26
+ export interface BahireHasabResult {
27
+ /** The input Ethiopian calendar year */
28
+ year: number;
29
+ /** Amete Alem (ዓመተ ዓለም): Solar years from Creation (5500 + EC year) */
30
+ ameteAlem: number;
31
+ /** Metene Rabiet (መጠነ ራብዒት): Leap year multiplier */
32
+ meteneRabiet: number;
33
+ /** The ruling Evangelist of the year (0 = John, 1 = Matthew, 2 = Mark, 3 = Luke) */
34
+ evangelist: {
35
+ index: number;
36
+ name: {
37
+ amharic: string;
38
+ english: string;
39
+ };
40
+ };
41
+ /** Weekday of Ethiopian New Year (1 Meskerem) */
42
+ newYearDay: {
43
+ index: number;
44
+ name: {
45
+ amharic: string;
46
+ english: string;
47
+ };
48
+ };
49
+ /** Metonic 19-year lunar cycle remainder */
50
+ medeb: number;
51
+ /** Wenber (ወንበር): Golden number within the Metonic cycle */
52
+ wenber: number;
53
+ /** Abektie (አበቅቴ): Age of the moon on Meskerem 1 */
54
+ abektie: number;
55
+ /** Metqi (መጥቅዕ): Day of the Paschal new moon */
56
+ metqi: number;
57
+ /** Beale Metqi feast anchor date */
58
+ bealeMetqi: EthiopianDate;
59
+ /** Nineveh Fast anchor date (all other movable feasts are offsets of this date) */
60
+ nineveh: EthiopianDate;
61
+ /** Map of all 11 calculated movable feasts and fasts of the liturgical year */
62
+ feasts: Record<string, LiturgicalHoliday>;
63
+ }
64
+ /**
65
+ * Calculates Bahire Hasab (ባሕረ ሃሳብ) liturgical calculations for a given Ethiopian year.
66
+ * Computes all 11 movable feasts, lunar parameters, evangelist, and fasting seasons.
67
+ *
68
+ * @param ethiopianYear The Ethiopian calendar year (e.g. 2017)
69
+ * @returns Complete BahireHasabResult object
70
+ * @example
71
+ * ```ts
72
+ * import { calculateBahireHasab } from '@zemendev/calendar';
73
+ *
74
+ * const computus = calculateBahireHasab(2017);
75
+ * console.log(computus.evangelist.name.english); // Luke
76
+ * console.log(computus.feasts.fasika.ethiopian); // Easter date
77
+ * ```
78
+ */
79
+ export declare function calculateBahireHasab(ethiopianYear: number): BahireHasabResult;
80
+ //# sourceMappingURL=bahireHasab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bahireHasab.d.ts","sourceRoot":"","sources":["../src/bahireHasab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB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C,CAAC;CAC3C;AAqGD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,iBAAiB,CA2E7E"}
@@ -0,0 +1,175 @@
1
+ import { addDays, toGregorian, getEthiopianWeekday } from "@zemendev/core";
2
+ const EVANGELISTS = [
3
+ { amharic: "ዮሐንስ", english: "John" },
4
+ { amharic: "ማቴዎስ", english: "Matthew" },
5
+ { amharic: "ማርቆስ", english: "Mark" },
6
+ { amharic: "ሉቃስ", english: "Luke" },
7
+ ];
8
+ const WEEKDAY_NAMES = [
9
+ { amharic: "እሁድ", english: "Sunday" },
10
+ { amharic: "ሰኞ", english: "Monday" },
11
+ { amharic: "ማክሰኞ", english: "Tuesday" },
12
+ { amharic: "ረቡዕ", english: "Wednesday" },
13
+ { amharic: "ሐሙስ", english: "Thursday" },
14
+ { amharic: "ዓርብ", english: "Friday" },
15
+ { amharic: "ቅዳሜ", english: "Saturday" },
16
+ ];
17
+ // Weekday offset for Beale Metqi (Sunday = 7 .. Saturday = 8)
18
+ const TEWSAK_MAP = {
19
+ 0: 7, // Sun
20
+ 1: 6, // Mon
21
+ 2: 5, // Tue
22
+ 3: 4, // Wed
23
+ 4: 3, // Thu
24
+ 5: 2, // Fri
25
+ 6: 8, // Sat
26
+ };
27
+ const MOVABLE_FEAST_OFFSETS = {
28
+ nineveh: {
29
+ offset: 0,
30
+ name: { amharic: "ጾመ ነነዌ", english: "Fast of Nineveh" },
31
+ tags: ["religious", "christian", "fasting"],
32
+ },
33
+ abiyTsome: {
34
+ offset: 14,
35
+ name: { amharic: "ዓቢይ ጾም", english: "Great Lent (Abiy Tsome)" },
36
+ tags: ["religious", "christian", "fasting"],
37
+ },
38
+ debrefeyit: {
39
+ offset: 41,
40
+ name: { amharic: "ደብረ ዘይት", english: "Mount of Olives" },
41
+ tags: ["religious", "christian"],
42
+ },
43
+ debreZeit: {
44
+ offset: 41,
45
+ name: { amharic: "ደብረ ዘይት", english: "Mount of Olives" },
46
+ tags: ["religious", "christian"],
47
+ },
48
+ hosanna: {
49
+ offset: 62,
50
+ name: { amharic: "ሆሣዕና", english: "Palm Sunday (Hosanna)" },
51
+ tags: ["religious", "christian"],
52
+ },
53
+ siklet: {
54
+ offset: 67,
55
+ name: { amharic: "ስቅለት", english: "Good Friday (Siklet)" },
56
+ tags: ["religious", "christian", "public"],
57
+ },
58
+ fasika: {
59
+ offset: 69,
60
+ name: { amharic: "ትንሣኤ (ፋሲካ)", english: "Easter (Fasika)" },
61
+ tags: ["religious", "christian", "public"],
62
+ },
63
+ rikbeKahnat: {
64
+ offset: 93,
65
+ name: { amharic: "ርክበ ካህናት", english: "Synod of Priests" },
66
+ tags: ["religious", "christian"],
67
+ },
68
+ erget: {
69
+ offset: 108,
70
+ name: { amharic: "ዕርገት", english: "Ascension (Erget)" },
71
+ tags: ["religious", "christian"],
72
+ },
73
+ paraclete: {
74
+ offset: 118,
75
+ name: { amharic: "ጰራቅሊጦስ", english: "Pentecost (Paraclete / Paraklitos)" },
76
+ tags: ["religious", "christian"],
77
+ },
78
+ paraklitos: {
79
+ offset: 118,
80
+ name: { amharic: "ጰራቅሊጦስ", english: "Pentecost (Paraclete / Paraklitos)" },
81
+ tags: ["religious", "christian"],
82
+ },
83
+ tsomeHawaryat: {
84
+ offset: 119,
85
+ name: { amharic: "ጾመ ሐዋርያት", english: "Apostles Fast" },
86
+ tags: ["religious", "christian", "fasting"],
87
+ },
88
+ tsomeDihenet: {
89
+ offset: 121,
90
+ name: { amharic: "ጾመ ድኅነት", english: "Salvation Fast" },
91
+ tags: ["religious", "christian", "fasting"],
92
+ },
93
+ };
94
+ /**
95
+ * Calculates Bahire Hasab (ባሕረ ሃሳብ) liturgical calculations for a given Ethiopian year.
96
+ * Computes all 11 movable feasts, lunar parameters, evangelist, and fasting seasons.
97
+ *
98
+ * @param ethiopianYear The Ethiopian calendar year (e.g. 2017)
99
+ * @returns Complete BahireHasabResult object
100
+ * @example
101
+ * ```ts
102
+ * import { calculateBahireHasab } from '@zemendev/calendar';
103
+ *
104
+ * const computus = calculateBahireHasab(2017);
105
+ * console.log(computus.evangelist.name.english); // Luke
106
+ * console.log(computus.feasts.fasika.ethiopian); // Easter date
107
+ * ```
108
+ */
109
+ export function calculateBahireHasab(ethiopianYear) {
110
+ const ameteAlem = 5500 + ethiopianYear;
111
+ const meteneRabiet = Math.floor(ameteAlem / 4);
112
+ const evangelistIndex = ameteAlem % 4;
113
+ const evangelist = {
114
+ index: evangelistIndex,
115
+ name: EVANGELISTS[evangelistIndex],
116
+ };
117
+ const tinteQemer = (ameteAlem + meteneRabiet) % 7;
118
+ const newYearWeekdayIndex = (tinteQemer + 1) % 7;
119
+ const newYearDay = {
120
+ index: newYearWeekdayIndex,
121
+ name: WEEKDAY_NAMES[newYearWeekdayIndex],
122
+ };
123
+ const medeb = ameteAlem % 19;
124
+ const wenber = medeb === 0 ? 18 : medeb - 1;
125
+ const abektie = (wenber * 11) % 30;
126
+ const rawMetqi = (wenber * 19) % 30;
127
+ // Edge-case fix: when rawMetqi is 0, it wraps to 30 (e.g. 2006 EC)
128
+ const metqi = rawMetqi === 0 ? 30 : rawMetqi;
129
+ const bealeMetqiMonth = metqi > 14 ? 1 : 2;
130
+ const bealeMetqiDay = metqi;
131
+ const bealeMetqi = {
132
+ year: ethiopianYear,
133
+ month: bealeMetqiMonth,
134
+ day: bealeMetqiDay,
135
+ };
136
+ const bealeMetqiWeekday = getEthiopianWeekday(bealeMetqi);
137
+ const tewsak = TEWSAK_MAP[bealeMetqiWeekday];
138
+ const mebajaHamerSum = bealeMetqiDay + tewsak;
139
+ const mebajaHamer = mebajaHamerSum > 30 ? mebajaHamerSum % 30 : mebajaHamerSum;
140
+ let ninevehMonth = metqi > 14 ? 5 : 6;
141
+ if (mebajaHamerSum > 30)
142
+ ninevehMonth++;
143
+ const nineveh = {
144
+ year: ethiopianYear,
145
+ month: ninevehMonth,
146
+ day: mebajaHamer,
147
+ };
148
+ const feasts = {};
149
+ for (const [key, info] of Object.entries(MOVABLE_FEAST_OFFSETS)) {
150
+ const feastDate = addDays(nineveh, info.offset);
151
+ feasts[key] = {
152
+ key,
153
+ name: info.name,
154
+ ethiopian: feastDate,
155
+ gregorian: toGregorian(feastDate),
156
+ movable: true,
157
+ tags: info.tags,
158
+ };
159
+ }
160
+ return {
161
+ year: ethiopianYear,
162
+ ameteAlem,
163
+ meteneRabiet,
164
+ evangelist,
165
+ newYearDay,
166
+ medeb,
167
+ wenber,
168
+ abektie,
169
+ metqi,
170
+ bealeMetqi,
171
+ nineveh,
172
+ feasts,
173
+ };
174
+ }
175
+ //# sourceMappingURL=bahireHasab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bahireHasab.js","sourceRoot":"","sources":["../src/bahireHasab.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAmD3E,MAAM,WAAW,GAAG;IAClB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;IACpC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;IACvC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;IACpC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE;CACpC,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE;IACrC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE;IACpC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;IACvC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE;IACxC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE;IACvC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ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;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,SAAS;QACT,YAAY;QACZ,UAAU;QACV,UAAU;QACV,KAAK;QACL,MAAM;QACN,OAAO;QACP,KAAK;QACL,UAAU;QACV,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { EthiopianDate } from "@zemendev/core";
2
+ export type FastingKey = "ABIY_TSOME" | "TSOME_HAWARYAT" | "TSOME_NEBIYAT" | "NINEVEH" | "FILSETA" | "TSOME_DIHENET" | "TSOME_TSIGE" | "GAHAD_GENNA" | "GAHAD_TIMKAT";
3
+ export interface FastingPeriod {
4
+ key: FastingKey;
5
+ name: {
6
+ amharic: string;
7
+ english: string;
8
+ };
9
+ start: EthiopianDate;
10
+ end: EthiopianDate;
11
+ totalDays: number;
12
+ isCanonical: boolean;
13
+ isVoluntary?: boolean;
14
+ }
15
+ export declare const FASTING_NAMES: Record<FastingKey, {
16
+ amharic: string;
17
+ english: string;
18
+ }>;
19
+ /**
20
+ * Returns the date boundaries of a specific fasting period for a given Ethiopian year.
21
+ */
22
+ export declare function getFastingPeriod(fastKey: FastingKey, year: number): FastingPeriod | null;
23
+ export interface FastingCheckResult {
24
+ isFasting: boolean;
25
+ reason?: string;
26
+ key?: FastingKey;
27
+ isCanonical?: boolean;
28
+ isVoluntary?: boolean;
29
+ }
30
+ /**
31
+ * Checks if a specific Ethiopian date is a fasting day in the Orthodox calendar.
32
+ * Includes canonical fasts + voluntary fasts (Tsome Tsige) + weekly Wednesday & Friday fasts
33
+ * (with Dominical Feast and Pentecost 50 exemptions).
34
+ */
35
+ export declare function isFastingDay(date: EthiopianDate, options?: {
36
+ includeVoluntary?: boolean;
37
+ }): FastingCheckResult;
38
+ export declare function getActiveFastingPeriod(date: EthiopianDate, options?: {
39
+ includeVoluntary?: boolean;
40
+ }): FastingPeriod | null;
41
+ //# sourceMappingURL=fasting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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