eliasdebelo/ethiopian-calendar

Ethiopian โ†” Gregorian calendar conversion

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/eliasdebelo/ethiopian-calendar

v1.2.0 2025-11-13 06:46 UTC

This package is auto-updated.

Last update: 2026-01-13 07:22:59 UTC


README

A modern, lightweight PHP library for seamless conversion between Ethiopian and Gregorian calendars. Ideal for applications serving Ethiopian users, historical calculations, and multicultural systems.

PHP License Packagist Tests

โœจ Features

  • ๐Ÿ”„ Bidirectional Conversion --- Ethiopian โ†” Gregorian\
  • ๐Ÿ“… Real-time Date Handling --- Get current dates in both calendars\
  • โœ… Robust Validation --- Clear error messages for invalid dates\
  • ๐ŸŽฏ Leap Year Support --- Accurate handling of Pagume 5/6 days\
  • ๐Ÿš€ High Performance --- Zero dependencies, optimized calculations\
  • ๐Ÿ’ช Type Safe --- PHP 8.0+ with strict type declarations\
  • ๐Ÿงช Fully Tested --- PHPUnit test coverage included\
  • ๐ŸŒ English Month Names --- Avoid encoding issues

๐Ÿ“ฆ Installation

composer require eliasdebelo/ethiopian-calendar

๐Ÿš€ Quick Start

<?php
require_once 'vendor/autoload.php';
use EliasDebelo\EthiopianCalendar\EthiopianCalendar;

// Ethiopian โ†’ Gregorian
echo EthiopianCalendar::toGregorian(2015, 4, 25); // "2024-01-03"

// Gregorian โ†’ Ethiopian
print_r(EthiopianCalendar::toEthiopian(2022, 3, 25)); // [2013, 7, 16]

// Today's dates
print_r(EthiopianCalendar::todayEthiopian());
echo EthiopianCalendar::todayGregorian();

// Format Ethiopian date
echo EthiopianCalendar::format(2015, 1, 1, 'j M Y'); // "1 Meskerem 2015"

// Leap year check
echo EthiopianCalendar::isLeapYear(2015) ? 'Leap year' : 'Not leap year';

๐Ÿ“š API Reference

Conversion Methods

  • toGregorian(int $year, int $month, int $day): string\
  • toEthiopian(int $year, int $month, int $day): array

Utilities

  • todayEthiopian(): array\
  • todayGregorian(): string\
  • format(int $year, int $month, int $day, string $format = "Y-m-d"): string\
  • getDaysInMonth(int $year, int $month): int\
  • getMonthName(int $month): string\
  • isLeapYear(int $year): bool\
  • isValidEthiopianDate(int $year, int $month, int $day): bool\
  • getEthiopianNewYear(int $gregorianYear): array\
  • getEthiopianNewYearDay(int $gregorianYear): int

๐Ÿ—“๏ธ Ethiopian Calendar Structure

Month English Name Days Gregorian Equivalent

1 Meskerem 30 Sep--Oct 2 Tikimit 30 Oct--Nov 3 Hidar 30 Nov--Dec 4 Tahsas 30 Dec--Jan 5 Tir 30 Jan--Feb 6 Yekatit 30 Feb--Mar 7 Megabit 30 Mar--Apr 8 Miyazya 30 Apr--May 9 Ginbot 30 May--Jun 10 Sene 30 Jun--Jul 11 Hamle 30 Jul--Aug 12 Nehase 30 Aug--Sep 13 Pagume 5/6* Sep

*Pagume has 5 days in common years, 6 days in leap years.

๐Ÿงช Running Tests

composer install
vendor/bin/phpunit --testdox
vendor/bin/phpunit --coverage-html coverage

๐Ÿ”ง Requirements

  • PHP 8.0+\
  • Composer

๐Ÿ“„ License

MIT License --- Open source.

๐Ÿค Contributing

  1. Fork the repo\
  2. Create a branch (git checkout -b feature/awesome)\
  3. Commit changes (git commit -m "Add feature")\
  4. Push (git push origin feature/awesome)\
  5. Open a Pull Request

๐Ÿ› Issues & Support