UNPKG

kenat

Version:

A JavaScript library for the Ethiopian calendar with date and time support.

803 lines (791 loc) 33.2 kB
/** Shared domain types used across Kenat's modules. */ type Lang = 'amharic' | 'english' | string; interface EthiopianDate { year: number; month: number; day: number; } interface GregorianDate { year: number; month: number; day: number; } type TimePeriod = 'day' | 'night'; interface LocalizedText { amharic: string; english: string; [lang: string]: string; } interface Holiday { key: string; tags: string[]; movable: boolean; name?: string; description?: string; ethiopian: EthiopianDate; gregorian?: GregorianDate; } interface DateRange { start: EthiopianDate; end: EthiopianDate; } type DiffUnit = 'years' | 'months' | 'days'; interface DiffBreakdown { sign: 1 | -1; totalDays: number; years?: number; months?: number; days?: number; } interface BahireHasabResult { ameteAlem: number; meteneRabiet: number; evangelist: { name: string; remainder: number; }; newYear: { dayName: string; tinteQemer: number; }; medeb: number; wenber: number; abektie: number; metqi: number; bealeMetqi: { date: EthiopianDate; weekday: string; }; mebajaHamer: number; nineveh: EthiopianDate; movableFeasts: Record<string, Holiday>; } /** * Calculates all Bahire Hasab values for a given Ethiopian year, including all movable feasts. * * @param {number} ethiopianYear - The Ethiopian year to calculate for. * @param {Object} [options={}] - Options for language. * @param {string} [options.lang='amharic'] - The language for names. * @returns {Object} An object containing all the calculated Bahire Hasab values. */ declare function getBahireHasab(ethiopianYear: number, options?: { lang?: Lang; }): BahireHasabResult; interface TimeFormatOptions { lang?: Lang; useGeez?: boolean; showPeriodLabel?: boolean; zeroAsDash?: boolean; } interface TimeDuration { hours?: number; minutes?: number; } declare class Time { hour: number; minute: number; period: TimePeriod; /** * Constructs a Time instance representing an Ethiopian time. * @param {number} hour - The Ethiopian hour (1-12). * @param {number} [minute=0] - The minute (0-59). * @param {string} [period='day'] - The period ('day' or 'night'). * @throws {InvalidTimeError} If any time component is invalid. */ constructor(hour: number, minute?: number, period?: TimePeriod); /** * Creates a Time instance from a Gregorian 24-hour time. * @param {number} hour - The Gregorian hour (0-23). * @param {number} [minute=0] - The minute (0-59). * @returns {Time} A new Time instance. * @throws {InvalidTimeError} If the Gregorian time is invalid. */ static fromGregorian(hour: number, minute?: number): Time; /** * Converts the Ethiopian time to Gregorian 24-hour format. * @returns {{hour: number, minute: number}} */ toGregorian(): { hour: number; minute: number; }; /** * Creates a `Time` object from a string representation. * * This static method parses a time string, which can include hours, minutes, and an optional period (day/night). * It supports both Arabic numerals (e.g., "1", "30") and Ethiopic numerals (e.g., "፩", "፴") for hours and minutes, * assuming a `toArabic` utility function is available to convert Ethiopic numerals to Arabic numbers. * * The time string must contain a colon (`:`) separating the hour and minute. * * @param {string} timeString - The string representation of the time. * Expected formats: * - "HH:MM" (e.g., "6:30", "፮:፴") * - "HH:MM period" (e.g., "6:30 night", "፮:፴ ማታ") * Where: * - HH: Hour (Arabic or Ethiopic numeral). * - MM: Minute (Arabic or Ethiopic numeral). * - period: Optional. Case-insensitive. Recognized values are "night" or "ማታ". * If the period is omitted, or if a third part is present but not recognized as "night" or "ማታ", * the time is assumed to be in the 'day' period. * * @returns {Time} A new `Time` object representing the parsed time. * * @throws {InvalidTimeError} If the `timeString` is: * - Not a string or an empty string. * - Missing the colon (`:`) separator. * - Formatted incorrectly (e.g., not enough parts after splitting). * - Contains non-numeric values for hour or minute that cannot be parsed into numbers * (neither as Arabic nor as Ethiopic numerals via `toArabic`). * */ static fromString(timeString: string): Time; /** * Adds a duration to the current time. * @param {{hours?: number, minutes?: number}} duration - Object with hours and/or minutes to add. * @returns {Time} A new Time instance with the added duration. */ add(duration: TimeDuration): Time; /** * Subtracts a duration from the current time. * @param {{hours?: number, minutes?: number}} duration - Object with hours and/or minutes to subtract. * @returns {Time} A new Time instance with the subtracted duration. */ subtract(duration: TimeDuration): Time; /** * Calculates the difference between this time and another. * @param {Time} otherTime - Another Time instance to compare against. * @returns {{hours: number, minutes: number}} An object with the absolute difference. */ diff(otherTime: Time): { hours: number; minutes: number; }; /** * Formats the time as a string. * @param {Object} [options] - Formatting options. * @param {string} [options.lang] - The language for the period label. Defaults to 'english' if useGeez is false, otherwise 'amharic'. * @param {boolean} [options.useGeez=true] - Whether to use Ge'ez numerals. * @param {boolean} [options.showPeriodLabel=true] - Whether to show the period label. * @param {boolean} [options.zeroAsDash=true] - Whether to represent zero minutes as a dash. * @returns {string} The formatted time string. */ format(options?: TimeFormatOptions): string; } interface KenatTimeInput { hour: number; minute: number; period: 'day' | 'night'; } type KenatInput = string | EthiopianDate | Date; interface FormatOptions { calendar?: 'ethiopian' | 'gregorian'; lang?: Lang; showWeekday?: boolean; useGeez?: boolean; includeTime?: boolean; } interface ToStringOptions { calendar?: 'ethiopian' | 'gregorian'; } interface ToISOStringOptions { calendar?: 'ethiopian' | 'gregorian'; } interface GetDateOptions { calendar?: 'ethiopian' | 'gregorian'; } interface CalendarDay { ethiopian: EthiopianDate & { display: string; }; gregorian: GregorianDate & { display: string; }; } interface StaticCalendarOptions { useGeez?: boolean; weekdayLang?: Lang; weekStart?: number; holidayFilter?: string | string[] | null; mode?: 'christian' | 'muslim' | 'public' | null; } interface StaticMonthCalendar { month: number; monthName: string; year: number | string; headers: string[]; days: unknown[]; } interface DistanceOptions { units?: DiffUnit[]; output?: 'object' | 'string'; lang?: 'english' | 'amharic'; } interface DistanceToHolidayOptions extends DistanceOptions { direction?: 'auto' | 'future' | 'past'; } /** * Kenat - Ethiopian Calendar Date Wrapper * * A lightweight class to work with both Gregorian and Ethiopian calendars. * It wraps JavaScript's built-in `Date` object and converts Gregorian dates to Ethiopian equivalents. * */ declare class Kenat { ethiopian: EthiopianDate; time: Time; /** * Constructs a Kenat instance. * Can be initialized with: * - An Ethiopian date string (e.g., '2016/1/1', '2016-1-1'). * - An object with { year, month, day }. * - A native JavaScript Date object (will be converted from Gregorian). * - No arguments, for the current date. * * @param {string|Object|Date} [input] - The date input. * @param {Object} [timeObj] - An optional time object. * @throws {InvalidEthiopianDateError} If the provided Ethiopian date is invalid. * @throws {InvalidDateFormatError} If the provided date string format is invalid. * @throws {UnrecognizedInputError} If the input format is unrecognized. */ constructor(input?: KenatInput, timeObj?: KenatTimeInput | null); /** * Creates and returns a new instance of the Kenat class representing the current moment. * * @returns {Kenat} A new Kenat instance set to the current date and time. */ static now(): Kenat; /** * Converts the current Ethiopian date stored in this.ethiopian to its Gregorian equivalent. * * @returns {{ year: number, month: number, day: number }} The Gregorian date corresponding to the Ethiopian date. */ getGregorian(): GregorianDate; /** * Returns the Ethiopian equivalent of the stored Gregorian date. * * @returns {{ year: number, month: number, day: number }} An object representing the Ethiopian date. */ getEthiopian(): EthiopianDate; /** * Returns the date in whichever calendar is requested, so callers with a * user-configurable calendar preference don't need an if/else between * getEthiopian() and getGregorian() at every call site. * * @param {Object} [options={}] - Options. * @param {'ethiopian'|'gregorian'} [options.calendar='ethiopian'] - Which calendar's date to return. * @returns {{ year: number, month: number, day: number }} */ getDate(options?: GetDateOptions): EthiopianDate | GregorianDate; /** * Sets the time and returns a new Kenat instance. * Supports method chaining. * * @param {number} hour - The hour value to set. * @param {number} minute - The minute value to set. * @param {string} period - The period of the day (e.g., 'day' or 'night'). * @returns {Kenat} A new Kenat instance with the updated time. */ setTime(hour: number, minute: number, period: 'day' | 'night'): Kenat; /** * Calculates and returns the Bahire Hasab values for the current instance's year. * * @returns {Object} An object containing all the calculated Bahire Hasab values * (ameteAlem, evangelist, wenber, metqi, nineveh, etc.). */ getBahireHasab(): BahireHasabResult; /** * Returns a string representation of the date and time, e.g. "መስከረም 1 2016 12:00 ጠዋት". * * @param {Object} [options={}] - Formatting options. * @param {'ethiopian'|'gregorian'} [options.calendar='ethiopian'] - Which calendar to render the date in. * 'gregorian' renders the Gregorian date with an English month name, e.g. "September 12, 2023 12:00 ጠዋት". * In both cases the time-of-day portion still reflects Kenat's Ethiopian 12-hour clock; use * toISOString({ calendar: 'gregorian' }) if you need the time converted to Gregorian 24-hour format. * @returns {string} The formatted date and time string. */ toString(options?: ToStringOptions): string; /** * Formats the date according to the specified options. * * @param {Object} [options={}] - Formatting options. * @param {'ethiopian'|'gregorian'} [options.calendar='ethiopian'] - Which calendar to render the date in. When * 'gregorian', the date is rendered using English Gregorian month names; `useGeez` is ignored. * @param {string} [options.lang='amharic'] - Language to use for formatting ('amharic', 'english', etc.). * @param {boolean} [options.showWeekday=false] - Whether to include the weekday in the formatted string. * @param {boolean} [options.useGeez=false] - Whether to use Geez numerals (only applies if lang is 'amharic'). * @param {boolean} [options.includeTime=false] - Whether to include the time in the formatted string. * @returns {string} The formatted date string. */ format(options?: FormatOptions): string; /** * Formats the Ethiopian date in Geez numerals and Amharic month name. * * @returns {string} The formatted date string in the format: "{Amharic Month Name} {Geez Day} {Geez Year}". * * formatInGeezAmharic(); // "የካቲት ፲ ፳፻፲፭" */ formatInGeezAmharic(): string; /** * Formats the Ethiopian date with weekday name. * * @param {'amharic'|'english'} [lang='amharic'] - Language for month and weekday names. * @param {boolean} [useGeez=false] - Whether to show numerals in Geez. * @returns {string} Formatted string with weekday, e.g. "ማክሰኞ, መስከረም ፳፩ ፳፻፲፯" */ formatWithWeekday(lang?: Lang, useGeez?: boolean): string; /** * Returns the Ethiopian date in "yyyy/mm/dd" short format. * @returns {string} */ formatShort(): string; /** * Returns an ISO-style date string: "YYYY-MM-DD" or "YYYY-MM-DDTHH:mm". * * @param {Object} [options={}] - Formatting options. * @param {'ethiopian'|'gregorian'} [options.calendar='ethiopian'] - Which calendar's date to render. * 'gregorian' produces a genuine ISO 8601 string: the date is Gregorian and the time is converted * from Kenat's Ethiopian 12-hour clock to Gregorian 24-hour time (e.g. 12:00 day -> 06:00), with * no non-standard suffix - useful for interop (e.g. `<input type="date">` or `new Date(...)`). * The default 'ethiopian' calendar keeps the existing Ethiopian-date, Ethiopian-time, ISO-*like* * string (including the non-standard `+12h` suffix for night times), unchanged for backward compatibility. * @returns {string} */ toISOString(options?: ToISOStringOptions): string; /** * Checks if the current date is a holiday. * @param {Object} [options={}] - Options for language. * @param {string} [options.lang='amharic'] - The language for the holiday names and descriptions. * @returns {Array<Object>} An array of holiday objects for the current date, or an empty array if it's not a holiday. */ isHoliday(options?: { lang?: Lang; }): Holiday[]; /** * Generates a calendar for a given Ethiopian month and year, mapping each Ethiopian date * to its corresponding Gregorian date and providing formatted display strings. * * @param {number} [year=this.ethiopian.year] - The Ethiopian year for the calendar. * @param {number} [month=this.ethiopian.month] - The Ethiopian month (1-13). * @param {boolean} [useGeez=false] - Whether to display dates in Geez numerals. * @returns {Array<Object>} An array of objects, each representing a day in the month with * Ethiopian and Gregorian date information and display strings. */ getMonthCalendar(year?: number, month?: number, useGeez?: boolean): CalendarDay[]; /** * Prints the calendar grid for the current Ethiopian month. * * @param {boolean} [useGeez=false] - If true, displays the calendar using Geez numerals. * @returns {void} */ printThisMonth(useGeez?: boolean): void; static getMonthCalendar(year: number, month: number, options?: StaticCalendarOptions): StaticMonthCalendar; /** * Generates a full-year calendar as an array of month objects for the specified year. * * @param {number} year - The year for which to generate the calendar. * @param {Object} [options={}] - Optional configuration for calendar generation. * @param {boolean} [options.useGeez=false] - Whether to use the Geez calendar system. * @param {string} [options.weekdayLang='amharic'] - Language for weekday names (e.g., 'amharic'). * @param {number} [options.weekStart=0] - The starting day of the week (0 = Sunday, 1 = Monday, etc.). * @param {function|null} [options.holidayFilter=null] - Optional filter function for holidays. * @returns {Array<Object>} An array of 13 month objects, each containing: * - {number} month: The month number (1-13). * - {string} monthName: The name of the month. * - {number} year: The year of the month. * - {Array<string>} headers: The headers for the days of the week. * - {Array<Array<Object>>} days: The grid of day objects for the month. */ static getYearCalendar(year: number, options?: StaticCalendarOptions): StaticMonthCalendar[]; /** * Generates an array of Kenat instances for a given date range. * @param {Kenat} startDate - The start of the range. * @param {Kenat} endDate - The end of the range. * @returns {Kenat[]} An array of Kenat objects. * @throws {InvalidInputTypeError} If start or end dates are not Kenat instances. */ static generateDateRange(startDate: Kenat, endDate: Kenat): Kenat[]; /** * Adds a specified amount of time to the current date. * Supports method chaining for fluent API. * * @param {number} amount - The amount to add. * @param {string} unit - The unit of time ('days', 'months', 'years'). * @returns {Kenat} A new Kenat instance representing the updated date. */ add(amount: number, unit: 'days' | 'months' | 'years'): Kenat; /** * Subtracts a specified amount of time from the current date. * Supports method chaining for fluent API. * * @param {number} amount - The amount to subtract. * @param {string} unit - The unit of time ('days', 'months', 'years'). * @returns {Kenat} A new Kenat instance representing the updated date. */ subtract(amount: number, unit: 'days' | 'months' | 'years'): Kenat; /** * Adds a specified number of days to the current Ethiopian date. * Maintains backward compatibility. * * @param {number} days - The number of days to add. * @returns {Kenat} A new Kenat instance representing the updated date. */ addDays(days: number): Kenat; /** * Returns a new Kenat instance with the date advanced by the specified number of months. * Maintains backward compatibility. * * @param {number} months - The number of months to add to the current date. * @returns {Kenat} A new Kenat instance representing the updated date. */ addMonths(months: number): Kenat; /** * Returns a new Kenat instance with the year increased by the specified number of years. * Maintains backward compatibility. * * @param {number} years - The number of years to add to the current date. * @returns {Kenat} A new Kenat instance representing the updated date. */ addYears(years: number): Kenat; /** * Calculates the difference in days between this object's Ethiopian date and another object's Ethiopian date. * * @param {Object} other - An object with a `getEthiopian` method that returns an Ethiopian date. * @returns {number} The number of days difference between the two Ethiopian dates. */ diffInDays(other: Kenat): number; /** * Calculates the difference in months between this instance's Ethiopian date and another Ethiopian date. * * @param {Object} other - An object with a `getEthiopian` method that returns an Ethiopian date. * @returns {number} The number of months difference between the two Ethiopian dates. */ diffInMonths(other: Kenat): number; /** * Calculates the difference in years between this instance's Ethiopian date and another. * * @param {Object} other - An object with a getEthiopian() method returning an Ethiopian date. * @returns {number} The number of years difference between the two Ethiopian dates. */ diffInYears(other: Kenat): number; getCurrentTime(): Time; /** * Checks if the current Kenat instance's date is before another Kenat instance's date. * @param {Kenat} other - The other Kenat instance to compare against. * @returns {boolean} True if the current date is before the other date. */ isBefore(other: Kenat): boolean; /** * Checks if the current Kenat instance's date is after another Kenat instance's date. * @param {Kenat} other - The other Kenat instance to compare against. * @returns {boolean} True if the current date is after the other date. */ isAfter(other: Kenat): boolean; /** * Checks if the current Kenat instance's date is the same as another Kenat instance's date. * @param {Kenat} other - The other Kenat instance to compare against. * @returns {boolean} True if the dates are the same. */ isSameDay(other: Kenat): boolean; /** * Checks if the current Kenat instance's date is in the same month and year as another. * @param {Kenat} other - The other Kenat instance to compare against. * @returns {boolean} True if the month and year are the same. */ isSameMonth(other: Kenat): boolean; /** * Checks if the current Kenat instance's date is in the same year as another. * @param {Kenat} other - The other Kenat instance to compare against. * @returns {boolean} True if the year is the same. */ isSameYear(other: Kenat): boolean; /** * Returns a plain object representation of the Kenat instance for JSON serialization. * @returns {{ ethiopian: {year: number, month: number, day: number}, gregorian: {year: number, month: number, day: number}, time: {hour: number, minute: number, period: string}|null }} */ toJSON(): { ethiopian: { year: number; month: number; day: number; }; gregorian: GregorianDate; time: { hour: number; minute: number; period: TimePeriod; } | null; }; /** * Returns a new Kenat instance set to the start of the specified unit. * Supports method chaining. * * @param {string} unit - The unit ('day', 'month', 'year'). * @returns {Kenat} A new Kenat instance. */ startOf(unit: 'day' | 'month' | 'year'): Kenat; /** * Returns a new Kenat instance set to the end of the specified unit. * Supports method chaining. * * @param {string} unit - The unit ('day', 'month', 'year'). * @returns {Kenat} A new Kenat instance. */ endOf(unit: 'day' | 'month' | 'year'): Kenat; /** * Returns a new Kenat instance set to the first day of the current month. * Maintains backward compatibility. * @returns {Kenat} A new Kenat instance. */ startOfMonth(): Kenat; /** * Returns a new Kenat instance set to the last day of the current month. * Maintains backward compatibility. * @returns {Kenat} A new Kenat instance. */ endOfMonth(): Kenat; /** * Checks if the current Ethiopian year is a leap year. * @returns {boolean} True if it is a leap year. */ isLeapYear(): boolean; /** * Returns the weekday number for the current date. * @returns {number} The day of the week (0 for Sunday, 6 for Saturday). */ weekday(): number; /** * Returns a breakdown of distance from this date to another date. * @param {Kenat|{year:number,month:number,day:number}|string|Date} other - target date * @param {{units?: ('years'|'months'|'days')[], output?: 'object'|'string', lang?: 'english'|'amharic'}} [options] * @returns {Object|string} */ distanceTo(other: Kenat | EthiopianDate | string | Date, options?: DistanceOptions): DiffBreakdown | string; /** * Returns a breakdown of distance from today to this date. */ distanceFromToday(options?: DistanceOptions): DiffBreakdown | string; /** * Returns distance from today to the specified holiday occurrence. * @param {string} holidayKey * @param {{direction?: 'auto'|'future'|'past', units?: ('years'|'months'|'days')[], output?: 'object'|'string', lang?: 'english'|'amharic'}} [options] */ static distanceToHoliday(holidayKey: string, options?: DistanceToHolidayOptions): DiffBreakdown | string; /** * Formats a breakdown result to human string like "1 year 2 months 5 days". */ static formatDistance(breakdown: DiffBreakdown, options?: DistanceOptions): string; static _coerceToKenat(input: Kenat | EthiopianDate | string | Date): Kenat; static _getHolidayOccurrence(holidayKey: string, refEth: EthiopianDate, which: 'next' | 'prev'): Kenat; } /** * Calculates a human-friendly breakdown between two Ethiopian dates. * Iteratively accumulates years, then months, then days to avoid off-by-one issues. * * @param {Object} a - First Ethiopian date { year, month, day }. * @param {Object} b - Second Ethiopian date { year, month, day }. * @param {Object} [options] * @param {Array<'years'|'months'|'days'>} [options.units=['years','months','days']] - Units to include, in order. * @returns {{ sign: 1|-1, years?: number, months?: number, days?: number, totalDays: number }} */ declare function diffBreakdown(a: EthiopianDate, b: EthiopianDate, options?: { units?: DiffUnit[]; }): DiffBreakdown; interface MonthGridConfig { year?: number; month?: number; weekStart?: number; useGeez?: boolean; weekdayLang?: Lang; holidayFilter?: string | string[] | null; mode?: 'christian' | 'muslim' | 'public' | null; showAllSaints?: boolean; } /** A holiday-like entry attached to a day cell; saint/Jummah entries are looser than a full `Holiday`. */ interface DayHolidayEntry { key: string; name?: string; description?: string; tags: string[]; isNigs?: boolean; ethiopian?: Holiday['ethiopian']; gregorian?: Holiday['gregorian']; movable?: boolean; } interface MonthGridDay { ethiopian: { year: number | string; month: number | string; day: number | string; }; gregorian: { year: number; month: number; day: number; }; weekday: number; weekdayName: string; isToday: boolean; holidays: DayHolidayEntry[]; } interface MonthGridResult { headers: string[]; days: (MonthGridDay | null)[]; year: number | string; month: number; monthName: string; up: () => MonthGridResult; down: () => MonthGridResult; } declare class MonthGrid { year: number; month: number; weekStart: number; useGeez: boolean; weekdayLang: Lang; holidayFilter: string | string[] | null; mode: 'christian' | 'muslim' | 'public' | null; showAllSaints: boolean; constructor(config?: MonthGridConfig); _validateConfig(config: MonthGridConfig): void; static create(config?: MonthGridConfig): MonthGridResult; generate(): MonthGridResult; _getRawDays(): CalendarDay[]; _getFilteredHolidays(): Holiday[]; _getSaintsMap(): Record<number, DayHolidayEntry[]>; _mergeDays(rawDays: any[], holidaysList: Holiday[], saintsMap: Record<number, DayHolidayEntry[]>): (MonthGridDay | null)[]; _getWeekdayHeaders(): string[]; _getLocalizedMonthName(): string; _getLocalizedYear(): number | string; up(): this; down(): this; } /** * Converts an Ethiopian date to its corresponding Gregorian date. * * @param {number} ethYear - The Ethiopian year. * @param {number} ethMonth - The Ethiopian month (1-13). * @param {number} ethDay - The Ethiopian day of the month. * @returns {{ year: number, month: number, day: number }} The equivalent Gregorian date. * @throws {InvalidInputTypeError} If any input is not a number. * @throws {InvalidEthiopianDateError} If the provided Ethiopian date is invalid. */ declare function toGC(ethYear: number, ethMonth: number, ethDay: number): GregorianDate; /** * Converts a Gregorian date to the Ethiopian calendar (EC) date. * * @param {number} gYear - The Gregorian year (e.g., 2024). * @param {number} gMonth - The Gregorian month (1-12). * @param {number} gDay - The Gregorian day of the month (1-31). * @returns {{ year: number, month: number, day: number }} The corresponding Ethiopian calendar date. * @throws {InvalidInputTypeError} If any input is not a number. * @throws {InvalidGregorianDateError} If the input date is invalid or out of supported range. */ declare function toEC(gYear: number, gMonth: number, gDay: number): EthiopianDate; /** * ethiopianNumberConverter.js * * Converts Arabic numerals (natural numbers) to their equivalent Ethiopic numerals. * Supports numbers from 1 up to 99999999. * * Example: * toGeez(1); // '፩' * toGeez(30); // '፴' * toGeez(123); // '፻፳፫' * toGeez(10000); // '፼' * * @author Melaku Demeke * @license MIT */ /** * Converts a natural number to Ethiopic numeral string. * * @param {number|string} input - The number to convert (positive integer only). * @returns {string} Ethiopic numeral string. * @throws {GeezConverterError} If input is not a valid positive integer. */ declare function toGeez(input: number | string): string; /** * Converts a Ge'ez numeral string to its Arabic numeral equivalent. * * @param {string} geezStr - The Ge'ez numeral string to convert. * @returns {number} The Arabic numeral representation of the input string. * @throws {GeezConverterError} If the input is not a valid Ge'ez numeral string. */ declare function toArabic(geezStr: string): number; declare function getHoliday(holidayKey: string, ethYear: number, options?: { lang?: Lang; }): Holiday | null; declare function getHolidaysInMonth(ethYear: number, ethMonth: number, options?: { lang?: Lang; filter?: string | string[] | null; }): Holiday[]; declare function getHolidaysForYear(ethYear: number, options?: { lang?: Lang; filter?: string | string[] | null; }): Holiday[]; declare const monthNames: { english: string[]; amharic: string[]; gregorian: string[]; }; declare const HolidayTags: { readonly PUBLIC: "public"; readonly RELIGIOUS: "religious"; readonly CHRISTIAN: "christian"; readonly MUSLIM: "muslim"; readonly STATE: "state"; readonly CULTURAL: "cultural"; readonly OTHER: "other"; }; declare const HolidayNames: Readonly<Record<string, string>>; declare const FastingKeys: { readonly ABIY_TSOME: "ABIY_TSOME"; readonly TSOME_HAWARYAT: "TSOME_HAWARYAT"; readonly TSOME_NEBIYAT: "TSOME_NEBIYAT"; readonly NINEVEH: "NINEVEH"; readonly FILSETA: "FILSETA"; readonly RAMADAN: "RAMADAN"; readonly TSOME_DIHENET: "TSOME_DIHENET"; }; /** * Calculates the start and end dates of a specific fasting period for a given year. * @param {'ABIY_TSOME' | 'TSOME_HAWARYAT' | 'TSOME_NEBIYAT' | 'NINEVEH' | 'RAMADAN'} fastKey - The key for the fast. * @param {number} ethiopianYear - The Ethiopian year. * @returns {{start: object, end: object}|null} An object with start and end PLAIN date objects. */ declare function getFastingPeriod(fastKey: string, ethiopianYear: number): DateRange | null; /** * Returns fasting information (names, descriptions, period) for a given fast and year. * @param {'ABIY_TSOME'|'TSOME_HAWARYAT'|'TSOME_NEBIYAT'|'NINEVEH'|'RAMADAN'} fastKey * @param {number} ethiopianYear * @param {{lang?: 'amharic'|'english'}} options * @returns {{ key: string, name: string, description: string, period: { start: object, end: object } } | null} */ declare function getFastingInfo(fastKey: string, ethiopianYear: number, options?: { lang?: Lang; }): { key: "TSOME_DIHENET"; name: string; description: string; tags: string[]; period: null; } | { key: string; name: string; description: string; tags: string[]; period: DateRange; } | null; /** * Return an array of day numbers in the given Ethiopian month that belong to a fasting period. * For TSOME_DIHENET, it returns all Wednesdays and Fridays excluding the 50-day period after Easter (through Pentecost). * For fixed/range fasts, it returns the days intersecting the fast period. * * @param {string} fastKey - One of FastingKeys * @param {number} year - Ethiopian year * @param {number} month - Ethiopian month (1-13) * @returns {number[]} */ declare function getFastingDays(fastKey: string, year: number, month: number): number[]; export { type BahireHasabResult, type CalendarDay, type DateRange, type DayHolidayEntry, type DiffBreakdown, type DiffUnit, type DistanceOptions, type DistanceToHolidayOptions, type EthiopianDate, FastingKeys, type FormatOptions, type GetDateOptions, type GregorianDate, type Holiday, HolidayNames, HolidayTags, type KenatInput, type KenatTimeInput, type Lang, type LocalizedText, MonthGrid, type MonthGridConfig, type MonthGridDay, type MonthGridResult, type StaticCalendarOptions, type StaticMonthCalendar, Time, type TimeDuration, type TimeFormatOptions, type TimePeriod, type ToISOStringOptions, type ToStringOptions, Kenat as default, diffBreakdown, getBahireHasab, getFastingDays, getFastingInfo, getFastingPeriod, getHoliday, getHolidaysForYear, getHolidaysInMonth, monthNames, toArabic, toEC, toGC, toGeez };