A Python package to convert dates between the Gregorian and Ethiopian calendars.
# Ethiopian Date Converter
A Python package to convert dates between the **Gregorian** and **Ethiopian** calendars. It supports localization, formatting, and various utilities for working with Ethiopian dates.
---
## **Installation**
You can install the package using
`pip install py-ethiopian-date-converter`
## **Features**
**Date Conversion:**
- Convert Gregorian dates to Ethiopian dates.
- Convert Ethiopian dates to Gregorian dates.
**Formatting:**
- Format Ethiopian dates with month names and time.
**Utilities:**
- Check if a year is a leap year in the Ethiopian calendar.
- Get the number of days in a month.
- Add days or years to an Ethiopian date.
- Compare Ethiopian dates.
- Calculate the difference in days between two dates.
## **Usage**
### **Basic Conversion**
```python
from ethiopian_date_converter.ethiopian_date_convertor import to_ethiopian, to_gregorian, EthDate
# Convert Ethiopian to Gregorian
ethiopian_date = EthDate(25, 1, 2016)
gregorian_date = to_gregorian(ethiopian_date)
print("Gregorian Date:", gregorian_date.strftime("%Y-%m-%d")) # Output: 2023-10-06
# Localization
# Get month name in Amharic
month_name = get_et_month_name(1, locale="AMH")
print("Month Name:", month_name) # Output: መስከረም
# Get month name in African Orthodox
month_name = get_et_month_name(1, locale="AO")
print("Month Name:", month_name) # Output: Fulbaana
# Format Ethiopian date
ethiopian_date = EthDate(25, 1, 2016)
print("Formatted Date:", ethiopian_date.formatted()) # Output: መስከረም 25, 2016
# Check if a year is a leap year
print("Is 2015 a leap year?", EthDate(1, 1, 2015).is_leap_year) # Output: True
# Add days to a date
new_date = EthDate(1, 1, 2016).add_days(30)
print("New Date:", new_date) # Output: EthDate(day=1, month=2, year=2016)
# Compare dates
date1 = EthDate(1, 1, 2016)
date2 = EthDate(2, 1, 2016)
print("Is date1 earlier than date2?", date1 EthDate`: Convert a Gregorian date to an Ethiopian date.
- `to_gregorian(ethiopian_date: EthDate) -> …