Skip to content

MelakuDemeke/kenat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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 GitHub ・ LinkedIn


πŸ“„ License

MIT β€” see LICENSE for details.

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •