jewish-date
Version:
Converts Gregorian dates to Hebrew dates and vice versa.
48 lines (47 loc) • 2.34 kB
TypeScript
/**
* Copyright (c) Shmulik Kravitz.
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory for more information.
*
*/
import type { BasicJewishDate, BasicJewishDateHebrew, JewishMonthType } from "./interfaces";
/**
* Returns the name of a Jewish month in Hebrew, given its type.
* @param {JewishMonthType} jewishMonth - The Jewish month type.
* @returns {string} - The name of the Jewish month in Hebrew.
*/
export declare const getJewishMonthInHebrew: (jewishMonth: JewishMonthType) => string;
/**
* Converts a number to its Hebrew equivalent in gematria
* @param num - The number to convert to Hebrew
* @param addGeresh - Whether or not to add a geresh symbol (') to the end of the number
* @param addPunctuate - Whether or not to add a punctuation mark (.) after the thousands digit
* @returns The Hebrew equivalent of the given number
*/
export declare const convertNumberToHebrew: (num: number, addGeresh?: boolean, addPunctuate?: boolean) => string;
/**
* Converts a year to its short Hebrew equivalent (last two significant digits).
* For example, 5783 → פ״ג (83 in gematria)
* @param year - The year to convert
* @returns The short Hebrew equivalent of the year
*/
export declare const convertYearToShortHebrew: (year: number) => string;
/**
* Converts a basic Jewish date object to a Hebrew date object with Hebrew letters.
* @param {BasicJewishDate} jewishDate - The basic Jewish date object to convert.
* @returns {BasicJewishDateHebrew} The Hebrew date object with Hebrew letters.
*/
export declare const toHebrewJewishDate: (jewishDate: BasicJewishDate) => BasicJewishDateHebrew;
/**
* Formats a Jewish date object into a string representation in Hebrew.
* @param {BasicJewishDate} jewishDate - The Jewish date object to format.
* @param {string} [pattern] - Optional format pattern (e.g., "D MMMM YYYY", "dd/MM/yyyy").
* Supported tokens:
* - Lowercase (numeric): d, dd (day), M, MM (month), yy, yyyy (year)
* - Uppercase (gematria): D (day), YY, YYYY (year)
* - MMMM (Hebrew month name)
* Default pattern: "D MMMM YYYY" (all Hebrew gematria)
* @returns {string} The Hebrew string representation of the Jewish date.
*/
export declare const formatJewishDateInHebrew: (jewishDate: BasicJewishDate, pattern?: string) => string;