Ethiopian Calendar

A Dart package for working with the Ethiopian Calendar (also known as Ge'ez Calendar), providing easy conversion between Ethiopian and Gregorian dates along with localized formatting options.

Features

  • Convert dates between Ethiopian and Gregorian calendars
  • Format Ethiopian dates in various styles (full, short, etc.)
  • Support for Amharic month and day names
  • Extension methods for easy date formatting
  • Accurate handling of Ethiopian calendar's unique characteristics:
    • 13 months (12 months of 30 days + 1 month of 5/6 days)
    • Different new year (September 11/12)
    • ~7/8 years difference from Gregorian calendar

Getting Started

Add this package to your project's pubspec.yaml:

dependencies:
  ethiopian_calendar_plus: ^1.0.0
  intl: ^any  # Required dependency

Usage

Basic Date Conversion

import 'package:ethiopian_calendar/ethiopian_calendar.dart';

void main() {
  // Convert from Gregorian to Ethiopian
  final gregorianDate = DateTime(2024, 3, 20);
  final ethiopianDate = EthiopianDateConverter.gregorianToEthiopian(gregorianDate);
  print(ethiopianDate); // Output: 2016-07-11

  // Convert from Ethiopian to Gregorian
  final backToGregorian = EthiopianDateConverter.ethiopianToGregorian(2016, 7, 11);
  print(backToGregorian); // Output: 2024-03-20
}

Formatting Ethiopian Dates

import 'package:ethiopian_calendar/ethiopian_calendar.dart';
import 'package:intl/intl.dart';

void main() {
  final date = DateTime(2024, 3, 20);
  final dateFormat = DateFormat();

  // Format with Amharic month names
  print(dateFormat.formatEthiopian(date)); 
  // Output: 11 መጋቢት 2016

  // Short format
  print(dateFormat.formatEthiopianShort(date)); 
  // Output: 11/7/2016

  // Full format with weekday
  print(dateFormat.formatEthiopianFull(date)); 
  // Output: ረቡዕ, 11 መጋቢት 2016

  // Get Ethiopian weekday
  print(dateFormat.getEthiopianWeekday(date)); 
  // Output: ረቡዕ
}

Working with Ethiopian Dates Directly

import 'package:ethiopian_calendar/ethiopian_calendar.dart';

void main() {
  final ethiopianDate = EthiopianDate(
    year: 2016,
    month: 7,
    day: 11,
  );
  
  print(ethiopianDate.toString()); // Output: 2016-07-11
}

Additional Information

Ethiopian Calendar Overview

The Ethiopian calendar:

  • Is approximately 7-8 years behind the Gregorian calendar
  • Has 13 months (12 months of 30 days each, plus a shorter 13th month)
  • Starts its new year on September 11 (or September 12 in leap years)
  • Uses its own era, called "Amätä Məhrät" (AM)

Contributing

Contributions are welcome! If you find a bug or want to add a feature:

  1. Open an issue to discuss the change
  2. Create a pull request with your changes
  3. Ensure all tests pass
  4. Update documentation as needed

Author

Alex Weldu

Support

If you find this package helpful, please consider giving it a star ⭐ on GitHub and a like 👍 on pub.dev.

For bugs or feature requests, please create an issue on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

converters
Provides conversion utilities between Ethiopian and Gregorian calendar systems.
ethiopian_date
Defines the Ethiopian date model and related utilities.
localization
Provides localization support for Ethiopian calendar with Amharic text.