Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

kenat

MelakuDemeke354MIT2.3.0

A JavaScript library for the Ethiopian calendar with date and time support.

ethiopian, calendar, ethiopian calendar, date, time, kenat, habesha, zemen, ethiopian date, geez calendar, ethiopian calendar library, amharic calendar, date converter, calendar converter, ethiopian holidays, react calendar, js calendar, javascript calendar, calendar component, Bahire Hasab, Abushakir

readme

Kenat / ቀናት NPM Version

banner

Build Status npm bundle size GitHub issues GitHub Repo stars GitHub forks GitHub commit activity npm downloads


Kenat / ቀናት

📌 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 (ባሕረ ሃሳብ).


✨ Features

  • 🔄 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.

🚀 Installation

npm install kenat
`

🔰 Quick Start

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"

⛪ Bahire Hasab & Holiday System

Get All Holidays for a Year

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 }
}

Filter Holidays by Tag

import { getHolidaysForYear, HolidayTags } from 'kenat';

const publicHolidays = getHolidaysForYear(2017, {
  filter: HolidayTags.PUBLIC
});

const religiousHolidays = getHolidaysForYear(2017, {
  filter: [HolidayTags.CHRISTIAN, HolidayTags.MUSLIM]
});

Check if a Specific Date is a Holiday

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()); // → []

Access Bahire Hasab Calculations

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
  }
}

➕ More API Examples

Date Arithmetic

const today = new Kenat();
const nextWeek = today.addDays(7);
const lastMonth = today.addMonths(-1);

Date Difference

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

Geez Numerals

import { toGeez } from 'kenat';

console.log(toGeez(2017)); // → "፳፻፲፯"

📊 API Reference

Refer to the full documentation site for method details, utility functions, and live examples.


🎉 Coming Soon

  • ✅ Ethiopian Seasons (Tseday, Bega, Kiremt, Meher)
  • ✅ Helpers like .isSameMonth() and .startOfYear()
  • 🚀 Multi-language ports (Python, PHP, Dart)
  • ⚙️ .ics iCalendar export

🧱 Contribution Guide

  1. Fork the repo & clone it.
  2. Create a new branch:

    git checkout -b feature/your-feature
  3. Write your changes and add tests in the /tests directory.
  4. Run npm test to ensure everything passes.
  5. Open a Pull Request with your improvements or bug fix.

👨‍💻 Author

Melaku Demeke GitHubLinkedIn


📄 License

MIT — see LICENSE for details.