ethiopian-calendar-new
v1.0.8
Published
Convert between Ethiopian and Gregorian calendars easily. Provides accurate conversions between dates in the Ethiopian and Gregorian calendars.
Downloads
880
Maintainers
Readme
markdown
Ethiopian Calendar Converter 🇪🇹
A lightweight and accurate JavaScript/TypeScript library to convert dates between the Gregorian and Ethiopian calendar systems. It handles leap years and the unique 13th month (Pagumē) of the Ethiopian calendar.
📦 Installation
Using npm or yarn:
npm install ethiopian-calendar-new
# or
yarn add ethiopian-calendar-new
## 🚀 Usage
Importing
You can use either ES Modules or CommonJS:
ES Modules (recommended):
##short snippet
import { toGregorian, toEthiopian } from 'ethiopian-calendar-new';
// Ethiopian to Gregorian
console.log(toGregorian(2017, 11, 19));
// ➜ { year: 2025, month: 7, day: 26 }
// Gregorian to Ethiopian
console.log(toEthiopian(2025, 7, 26));
// ➜ { year: 2017, month: 11, day: 19 }
##import and CommonJS require syntax
CommonJS (Node.js):
const { toGregorian, toEthiopian } = require('ethiopian-calendar-new');
🔄 Convert Ethiopian → Gregorian
const ethiopianDate = { year: 2017, month: 1, day: 1 };
const gregorian = toGregorian(ethiopianDate.year, ethiopianDate.month, ethiopianDate.day);
console.log(gregorian); // { year: 2024, month: 9, day: 11 }
//or
##📘 API
toGregorian(year, month, day) → converts Ethiopian → Gregorian
toEthiopian(year, month, day) → converts Gregorian → Ethiopian
🙏 Acknowledgments
Calculations based on the Ethiopian calendar system.