The Ethiopian Holiday System in Kenat
The kenat
library has a comprehensive system for calculating and categorizing the many holidays observed in Ethiopia. This system understands the nuances between fixed holidays, movable Christian feasts, and movable Islamic holidays, and provides a powerful tagging system for filtering them.
Kenat provides three main functions for working with holidays:
getHolidaysForYear(year, options)
: Get all holidays for a given Ethiopian year.getHolidaysInMonth(year, month, options)
: Get holidays for a specific Ethiopian month.getHoliday(key, year, options)
: Get details for a single holiday by key and year.
All functions accept an optional lang
parameter (default: βamharicβ) to control the language of holiday names and descriptions.
Returned holidays are sorted by day. Islamic holidays may occur twice in one Ethiopian year.
If you provide an invalid key or date, the functions return null
or throw an error describing the issue.
Holiday Types
Kenat processes three distinct types of holidays to ensure accurate date reporting.
All holidays are returned as objects with fields like:
key
: The holiday key (e.g., βenkutatashβ)ethiopian
: Ethiopian date{ year, month, day }
gregorian
: Gregorian date{ year, month, day }
name
: Holiday name (localized)description
: Holiday description (localized)tags
: Array of tags
1. Fixed Holidays
These are holidays that occur on the same date in the Ethiopian calendar every year.
- Examples:
- Enkutatash (New Year): Meskerem 1
- Meskel (Finding of the True Cross): Meskerem 17
- Gena (Ethiopian Christmas): Tahsas 29
- Adwa Victory Day: Yekatit 23
- Implementation: These dates are stored in a
fixedHolidays
map within the library for direct lookup.
2. Movable Christian Holidays
These are holidays whose dates change each year. Their calculation is based on the date of Easter (Tinsaye
), which is determined by the ancient Bahire Hasab computational system.
- Examples:
- Nineveh (Fast of Nineveh)
- Abiy Tsome (Great Lent)
- Fasika (Easter)
- Implementation: The library first calculates the date of the Fast of Nineveh for the given year, and all other movable feasts are determined by adding a fixed number of days from that date.
3. Movable Islamic Holidays
These holidays are based on the Islamic Hijri calendar, which is a lunar calendar. Because the lunar year is shorter than the solar Ethiopian year, the dates of these holidays shift annually and can sometimes occur twice within a single Ethiopian year.
Kenat will return all occurrences of an Islamic holiday in a year, so you may see duplicates in the results.
- Examples:
- Eid al-Fitr (End of Ramadan)
- Eid al-Adha (Feast of the Sacrifice)
- Moulid (The Prophetβs Birthday)
- Implementation: The library calculates all possible Gregorian occurrences of a Hijri date within the span of an Ethiopian year and converts them to their Ethiopian calendar equivalents.
Filtering with HolidayTags
To make it easy to find specific types of holidays, every holiday in kenat
is categorized with one or more tags. These are available in the exported HolidayTags
object.
You can use the following tags for filtering:
PUBLIC
: Public national holidayRELIGIOUS
: Religious significanceCHRISTIAN
: Christian holidayMUSLIM
: Muslim holidaySTATE
: Civic eventCULTURAL
: Cultural significanceOTHER
: Other observances
The available tags are:
PUBLIC
: A public national holiday.RELIGIOUS
: A holiday of religious significance.CHRISTIAN
: A Christian holiday.MUSLIM
: A Muslim holiday.STATE
: A state holiday commemorating a civic event.CULTURAL
: A holiday of cultural significance.OTHER
: Any other type of observance.
Example: Using the filter
Option
You can pass a tag (string) or an array of tags to the filter
option in functions like getHolidaysForYear
and getHolidaysInMonth
.
When you provide an array of tags, the filter returns holidays that match at least one of the tags provided (an βORβ search).
You can also use the lang
option to get results in English:
const publicHolidaysEn = getHolidaysForYear(year, {
filter: HolidayTags.PUBLIC,
lang: 'english'
});
undefined
import { getHolidaysForYear, HolidayTags } from 'kenat';
const year = 2017; // E.C.
// Example 1: Get only public holidays by passing a single tag.
const publicHolidays = getHolidaysForYear(year, {
filter: HolidayTags.PUBLIC
});
console.log(`Found ${publicHolidays.length} public holidays in ${year} E.C.`);
// Expected: Lists all holidays tagged as 'public'.
// Example 2: Get holidays that are 'MUSLIM' OR 'STATE'.
// Pass an array of tags to the filter option.
const muslimOrStateHolidays = getHolidaysForYear(year, {
filter: [HolidayTags.MUSLIM, HolidayTags.STATE]
});
console.log(`Found ${muslimOrStateHolidays.length} holidays that are either Muslim or State holidays.`);
// Example 3: Get holidays for a specific month
import { getHolidaysInMonth } from 'kenat';
const monthHolidays = getHolidaysInMonth(year, 1, { filter: HolidayTags.PUBLIC });
console.log(monthHolidays);
// Example 4: Get a single holiday by key
import { getHoliday } from 'kenat';
const meskel = getHoliday('meskel', year);
console.log(meskel);