Skip to Content
Kenat is a work in progress project πŸ‘¨πŸ»β€πŸ’»
DocumentationπŸ“¦ Installation

πŸ“¦ Installation

undefined

πŸ›  Install with a Package Manager

npm install kenat

βœ… Supported Environments

  • Node.js β‰₯ 14
  • Modern browsers (ES6+)
  • Works with React, Vue, Svelte, etc.
  • Not tested on legacy browsers like IE11

πŸ“₯ Import & Usage

Kenat supports both default and named imports:

import Kenat, { getHolidaysForYear, HolidayTags, toEC, toGC, formatStandard } from 'kenat'; // Create a date const date = new Kenat(); console.log(date.getEthiopian()); // Use named exports const holidays = getHolidaysForYear(2017, { filter: HolidayTags.PUBLIC }); console.log(holidays); // Convert Gregorian to Ethiopian const etDate = toEC(2025, 7, 18); // { year, month, day } console.log(etDate); // Format an Ethiopian date const formatted = formatStandard({ year: 2017, month: 10, day: 5 }, 'english'); console.log(formatted);

πŸ”„ ES Modules & CommonJS

Kenat is published as an ES module. For CommonJS, use dynamic import:

(async () => { const { default: Kenat, getHolidaysForYear } = await import('kenat'); console.log(new Kenat().toString()); console.log(getHolidaysForYear(2017)); })();

πŸ§ͺ Verify Installation

node -e "import('kenat').then(m => console.log(new m.default().toString()))"

Expected Output:

Ethiopian: 2017-9-21

πŸ—‚ Quick Reference: Named Exports

  • Kenat (default)
  • MonthGrid
  • Time
  • toEC, toGC, toGeez, toArabic
  • getHolidaysForYear, getHolidaysInMonth, getHoliday
  • HolidayTags, monthNames
  • getBahireHasab, getFastingPeriod
  • Formatting: formatStandard, formatWithWeekday, formatWithTime, formatInGeezAmharic, formatShort, toISODateString

⚠️ Error Handling

If you provide invalid input (e.g., out-of-range date, wrong format), Kenat will throw an error describing the issue.

Last updated on