A PostgreSQL extension that Convert between Gregorian and Ethiopian calendar dates
# pg_ethiopian_calendar
A PostgreSQL extension for converting between Gregorian and Ethiopian calendar dates.
## Description
The Ethiopian calendar (Ge'ez calendar) is a solar calendar with 13 months used in Ethiopia and Eritrea. This extension provides functions to convert dates between Gregorian and Ethiopian calendars using academically verified algorithms from "Calendrical Calculations" by Dershowitz & Reingold.
**Key Features:**
- Bidirectional conversion (Gregorian ↔ Ethiopian)
- IMMUTABLE functions for use in indexes and generated columns
- Time-preserving conversions
- NULL-safe operations
## Installation
Choose the method that best fits your setup:
### Option 1: NPM Package (Recommended for Prisma/Drizzle/ORMs)
**Works on any PostgreSQL** including Neon, Supabase, Railway, AWS RDS, and more. No Docker or C compilation required!
```bash
# Install
npm install @huluwz/pg-ethiopian-calendar
# Initialize (auto-detects your ORM)
npx ethiopian-calendar init
# Apply migration (example for Prisma)
npx prisma migrate dev
```
Supports: **Prisma**, **Drizzle**, **TypeORM**, and raw SQL.
📖 Full NPM Package Documentation
### Option 2: Docker Hub
Pre-built PostgreSQL images with the extension installed:
```bash
# Pull the image (PostgreSQL 14, 15, 16, or 17)
docker pull huluwz/pg-ethiopian-calendar:latest # PostgreSQL 17
docker pull huluwz/pg-ethiopian-calendar:1.1.0-pg16 # PostgreSQL 16
docker pull huluwz/pg-ethiopian-calendar:1.1.0-pg15 # PostgreSQL 15
docker pull huluwz/pg-ethiopian-calendar:1.1.0-pg14 # PostgreSQL 14
# Run the container
docker run -d \
--name ethiopian-calendar-db \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
huluwz/pg-ethiopian-calendar:latest
# Connect and enable the extension
psql -h localhost -U postgres -c "CREATE EXTENSION pg_ethiopian_calendar;"
psql -h localhost -U postgres -c "SELECT to_ethiopian_date('2025-12-17');"
```
**Docker Hub:**
### Option 3: From PGXN
For self-hosted PostgreSQL with ad …