π¦ Installation
undefined
π Install with a Package Manager
npm
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)MonthGridTimetoEC,toGC,toGeez,toArabicgetHolidaysForYear,getHolidaysInMonth,getHolidayHolidayTags,monthNamesgetBahireHasab,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