π Overview
Kenat (Amharic: ααα΅) is a comprehensive JavaScript library for the Ethiopian calendar. It provides a complete toolset for developers, handling date conversions, advanced formatting, full date arithmetic, and a powerful, authentic holiday calculation system based on the traditional Bahire Hasab (α£αα¨ αα³α₯).
- π Bidirectional Conversion: Seamlessly convert between Ethiopian and Gregorian calendars.
- ποΈ Complete Holiday System: Pre-loaded with all public, religious (Christian & Muslim), and cultural holidays.
- π Advanced Holiday Filtering: Easily filter holidays by tags (e.g., public, christian, muslim).
- π Authentic Liturgical Calculations: Implements Bahire Hasab for movable feasts and fasts.
- π Localized Formatting: Display dates in both Amharic and English.
- π’ Geez Numerals: Convert numbers and dates to traditional Geez numeral equivalents.
- β Full Date Arithmetic: Add or subtract days, months, and years with support for the 13-month calendar.
βοΈ Date Difference: Calculate precise differences between two dates.- π Ethiopian Time: Convert between 24-hour Gregorian and 12-hour Ethiopian time.
- ποΈ Calendar Generation: Create monthly or yearly calendar grids.
npm install kenat
Get todayβs Ethiopian date:
import Kenat from 'kenat';
const today = new Kenat();
console.log(today.getEthiopian());
// β { year: 2017, month: 9, day: 26 }
console.log(today.format({ lang: 'english', showWeekday: true }));
// β "Friday, Ginbot 26 2017"
import { getHolidaysForYear } from 'kenat';
const holidaysIn2017 = getHolidaysForYear(2017);
console.log(holidaysIn2017.find(h => h.key === 'fasika'));
// Output for Fasika (Easter) in 2017
{
key: 'fasika',
tags: ['public', 'religious', 'christian'],
movable: true,
name: 'αα²α«',
description: 'α¨α’α¨α±α΅ ααα΅αΆα΅α α¨αα³α ααα£α΅ α«α¨α₯α«αα’...',
ethiopian: { year: 2017, month: 8, day: 21 },
gregorian: { year: 2025, month: 4, day: 29 }
}
import { getHolidaysForYear, HolidayTags } from 'kenat';
const publicHolidays = getHolidaysForYear(2017, {
filter: HolidayTags.PUBLIC
});
const religiousHolidays = getHolidaysForYear(2017, {
filter: [HolidayTags.CHRISTIAN, HolidayTags.MUSLIM]
});
const meskel = new Kenat('2017/1/17');
console.log(meskel.isHoliday()); // β Returns the Meskel holiday object
const notHoliday = new Kenat('2017/1/18');
console.log(notHoliday.isHoliday()); // β []
const bahireHasab = new Kenat('2017/1/1').getBahireHasab();
console.log(bahireHasab.evangelist);
// β { name: 'αα΄αα΅', remainder: 1 }
console.log(bahireHasab.movableFeasts.fasika.ethiopian);
// β { year: 2017, month: 8, day: 21 }
// Full output of .getBahireHasab() for 2017
{
ameteAlem: 7517,
meteneRabiet: 1879,
evangelist: { name: 'αα΄αα΅', remainder: 1 },
newYear: { dayName: 'α¨α‘α', tinteQemer: 2 },
medeb: 12,
wenber: 11,
abektie: 1,
metqi: 29,
bealeMetqi: { date: { year: 2017, month: 1, day: 29 }, weekday: 'Wednesday' },
mebajaHamer: 3,
nineveh: { year: 2017, month: 6, day: 3 },
movableFeasts: {
nineveh: { /* ... */ },
abiyTsome: { /* ... */ },
fasika: {
key: 'fasika',
tags: ['public', 'religious', 'christian'],
movable: true,
name: 'αα²α«',
description: 'α¨α’α¨α±α΅ ααα΅αΆα΅α α¨αα³α ααα£α΅ α«α¨α₯α«αα’...',
ethiopian: { year: 2017, month: 8, day: 21 },
gregorian: { year: 2025, month: 4, day: 29 }
},
// ... other movable holidays
}
}
const today = new Kenat();
const nextWeek = today.addDays(7);
const lastMonth = today.addMonths(-1);
const a = new Kenat('2015/5/15');
const b = new Kenat('2012/5/15');
console.log(a.diffInDays(b)); // β 1095
console.log(a.diffInYears(b)); // β 3
import { toGeez } from 'kenat';
console.log(toGeez(2017)); // β "α³α»α²α―"
Refer to the full documentation site for method details, utility functions, and live examples.
- β Ethiopian Seasons (Tseday, Bega, Kiremt, Meher)
- β
Helpers like
.isSameMonth()
and.startOfYear()
- π Multi-language ports (Python, PHP, Dart)
- βοΈ
.ics
iCalendar export
-
Fork the repo & clone it.
-
Create a new branch:
git checkout -b feature/your-feature
-
Write your changes and add tests in the
/tests
directory. -
Run
npm test
to ensure everything passes. -
Open a Pull Request with your improvements or bug fix.
Melaku Demeke GitHub γ» LinkedIn
MIT β see LICENSE
for details.