A utility package for Ethiopian date conversion, payment scheduling, and holiday checks.
# qen.js πͺπΉ
A utility package for Ethiopian date conversion, payment scheduling, and holiday checks.
## Features
- Convert between Ethiopian and Gregorian dates.
- Generate payment schedules (e.g., monthly, quarterly).
- Check Ethiopian public holidays.
- Format dates in Amharic.
- Calculate late fees for overdue payments.
---
## Installation
Install `qen.js` using npm:
```bash
npm install qen.js
```
---
## Usage
### 1. Convert Gregorian to Ethiopian Date
Convert a Gregorian date to an Ethiopian date.
```javascript
const { EthiopianDate } = require('qen.js');
// Convert a Gregorian date to Ethiopian date
const gregorianDate = new Date(2023, 9, 30); // October 30, 2023
const ethiopianDate = EthiopianDate.fromGregorian(gregorianDate);
console.log(ethiopianDate.format('YYYY-MM-DD')); // Output: 2015-02-20
console.log(ethiopianDate.formatAmharic()); // Output: 20 α¨α«α²α΅ 2015
```
**Response:**
```bash
2015-02-20
20 α¨α«α²α΅ 2015
```
---
### 2. Generate a Payment Schedule
Generate a payment schedule for a given start date.
```javascript
const startDate = new EthiopianDate(2015, 2, 20); // 20 Yekatit 2015
const schedule = startDate.generatePaymentSchedule(1, 12); // Monthly payments for 1 year
console.log('Payment Schedule:');
schedule.forEach((date, index) => {
console.log(`Payment ${index + 1}: ${date.formatAmharic()}`);
});
```
**Response:**
```bash
Payment Schedule:
Payment 1: 20 α¨α«α²α΅ 2015
Payment 2: 20 ααα’α΅ 2015
Payment 3: 20 αα«αα« 2015
Payment 4: 20 ααα¦α΅ 2015
Payment 5: 20 α°α 2015
Payment 6: 20 ααα 2015
Payment 7: 20 ααα° 2015
Payment 8: 20 αα©α 2015
Payment 9: 20 αα³αα¨α 2016
Payment 10: 20 α₯α
αα΅ 2016
Payment 11: 20 α
α³α 2016
Payment 12: 20 α³αα³α΅ 2016
```
---
### 3. Check if a Date is a Holiday
Check if a specific date is an Ethiopian public holiday.
```javascript
const isHoliday = EthiopianDate.isHoliday(2015, 1, 1); // Ethiopian New Year
console.log(isHoliday); // Output: Ethiopian New Year
```
**Response:**
```bash
Ethiopian New Year
```
---
### 4. Cal β¦