Logo Lanfrica

Liyumk/ec-converter

Record type:

software
Creator:
Liy
Host:
Convert the Ethiopian calendar to the Gregorian calendar and vice versa. # EC-Converter A JavaScript/TypeScript library for converting between Ethiopian calendar and Gregorian calendar. ## Features - Convert dates from Gregorian to Ethiopian calendar - Convert dates from Ethiopian to Gregorian calendar - Validate dates in both calendar systems - Written in TypeScript with full type definitions - Zero dependencies - Comprehensive test coverage ## Installation ```bash npm install ec-converter ``` or ```bash yarn add ec-converter ``` ## Usage ### Converting from Gregorian to Ethiopian ```typescript import { toEthiopian } from 'ec-converter'; // September 11, 2023 (Gregorian) -> Meskerem 1, 2016 (Ethiopian) const ethiopianDate = toEthiopian({ year: 2023, month: 9, day: 11 }); console.log(ethiopianDate); // Output: { year: 2016, month: 1, day: 1 } ``` ### Converting from Ethiopian to Gregorian ```typescript import { toGregorian } from 'ec-converter'; // Meskerem 1, 2016 (Ethiopian) -> September 11, 2023 (Gregorian) const gregorianDate = toGregorian({ year: 2016, month: 1, day: 1 }); console.log(gregorianDate); // Output: { year: 2023, month: 9, day: 11 } ``` ### Validating Dates ```typescript import { isValidEthiopianDate, isValidGregorianDate } from 'ec-converter'; // Check if a Gregorian date is valid console.log(isValidGregorianDate({ year: 2023, month: 2, day: 29 })); // Output: false (2023 is not a leap year) // Check if an Ethiopian date is valid console.log(isValidEthiopianDate({ year: 2016, month: 13, day: 6 })); // Output: true (2016 is a leap year in Ethiopian calendar) ``` ## Ethiopian Calendar Overview The Ethiopian calendar: - Is approximately 7-8 years behind the Gregorian calendar - Has 13 months: 12 months of 30 days each and a 13th month of 5 or 6 days - Has a leap year every 4 years, similar to the Gregorian calendar but with different rules - Starts its new year on what is September 11 (or September 12 in leap years) in the Gregorian calendar ### Month Names 1. Meskerem (መስከረም) - 30 days 2. Tikimt …

Languages

Licenses