Accurate, dependency-free conversions between Ethiopian (Ethiopic) and Gregorian calendars in TypeScript
# negus-ethiopic-gregorian
Accurate, dependency-free conversions between **Ethiopian (Ethiopic)** and **Gregorian** calendars in **TypeScript**. Tiny bundle, strict types, tree-shakeable, and designed for extension (highlights/holidays & locales).
> Algorithms follow well-known references and community-vetted implementations. See **Accuracy & references** below.
## Install
```bash
npm i negus-ethiopic-gregorian
# or pnpm add / yarn add
```
## Quick start
```ts
import {
toGregorian, toEthiopic, today,
yearProgress, nextWeek
} from 'negus-ethiopic-gregorian';
import {
ETHIOPIAN_HIGHLIGHTS, GREGORIAN_HIGHLIGHTS,
getHighlightsForDay, getTodaysHighlights, searchHighlights
} from 'negus-ethiopic-gregorian/highlights';
// Highlight helpers live in a separate entry so the core converter stays tiny ( { year: 2024, month: 9, day: 11 }
// Convert GC → EC
const e = toEthiopic({ year: 2025, month: 1, day: 7 }); // => { year: 2017, month: 4, day: 29, era: 'AM' }
// Utilities
const ecToday = today('ethiopic');
const next = nextWeek(ecToday as any, 'ethiopic');
const gp = yearProgress({ year: 2025, month: 9, day: 21 }, 'gregorian');
// -> { daysLeft, totalDaysInYear, percentCompleted }
// Highlights (with utility functions)
console.log(getTodaysHighlights());
// Returns all highlights for today with both English and Amharic names
// Get highlights for a specific date
const dayHighlights = getHighlightsForDay({ year: 2017, month: 1, day: 1 }, 'ethiopic');
console.log(dayHighlights[0].amharicName); // "እንቁጣጣሽ (ኢትዮጵያ አዲስ ዓመት)"
// Search highlights by name
const searchResults = searchHighlights('New Year');
console.log(searchResults.length); // 2 (both Ethiopian and Gregorian New Year)
```
## API (selected)
* `toGregorian(ed: EthiopicDate): GregorianDate`
* `toEthiopic(gd: GregorianDate): EthiopicDate`
* `isEthiopicLeapYear(y: number, era?: 'AM'|'AA'): boolean`
* `ethiopicDaysInMonth(y: number, m: number, era?: Era): number`
* `gregorianDaysInMonth(y: number, m: number …