@hebcal/hdate
Version:
converts between Hebrew and Gregorian dates using Rata Die (R.D.) algorithm by Dershowitz and Reingold
41 lines (40 loc) • 1.57 kB
TypeScript
/**
* Returns true if the Gregorian year is a leap year
* @param year Gregorian year
*/
export declare function isGregLeapYear(year: number): boolean;
/**
* Number of days in the Gregorian month for given year
* @param month Gregorian month (1=January, 12=December)
* @param year Gregorian year
*/
export declare function daysInGregMonth(month: number, year: number): number;
/**
* Returns true if the object is a Javascript Date
*/
export declare function isDate(obj: unknown): boolean;
/**
* Converts Gregorian date to absolute R.D. (Rata Die) days
* @param date Gregorian date
*/
export declare function greg2abs(date: Date): number;
/**
* Converts from Rata Die (R.D. number) to Gregorian date.
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
* Clamen, Software--Practice and Experience, Volume 23, Number 4
* (April, 1993), pages 383-404 for an explanation.
*
* Note that this function returns the daytime portion of the date.
* For example, the 15th of Cheshvan 5769 began at sundown on
* 12 November 2008 and continues through 13 November 2008. This
* function would return only the date 13 November 2008.
* @param abs - R.D. number of days
* @example
* const abs = hebrew2abs(5769, months.CHESHVAN, 15);
* const date = abs2greg(abs); // 13 November 2008
* const year = date.getFullYear(); // 2008
* const monthNum = date.getMonth() + 1; // 11
* const day = date.getDate(); // 13
*/
export declare function abs2greg(abs: number): Date;