@hebcal/core
Version:
A perpetual Jewish Calendar API
109 lines (108 loc) • 3.9 kB
TypeScript
import { HDate } from '@hebcal/hdate';
import './locale';
/** The result from `Sedra.lookup()` */
export type SedraResult = {
/**
* Name of the parsha (or parshiyot) read on
* Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`
*/
parsha: string[];
/**
* True if this is a regular parasha HaShavua
* Torah reading, false if it's a special holiday reading
*/
chag: boolean;
/**
* The parsha number (or numbers) using 1-indexing.
* A `number` for a regular (single) parsha, and a `number[]`
* for a doubled parsha.
* For Parashat *Bereshit*, `num` would be equal to `1`, and for
* *Matot-Masei* it would be `[42, 43]`
*/
num?: number | number[];
/** The date of the Shabbat this parsha is read */
hdate: HDate;
};
/**
* Represents Parashah HaShavua for an entire Hebrew year
*/
export declare class Sedra {
private readonly year;
private readonly il;
private readonly firstSaturday;
private readonly theSedraArray;
private readonly yearKey;
/**
* Caculates the Parashah HaShavua for an entire Hebrew year
* @param hyear - Hebrew year (e.g. 5749)
* @param il - Use Israel sedra schedule (false for Diaspora)
*/
constructor(hyear: number, il: boolean);
/**
* Returns the parsha (or parshiyot) read on Hebrew date
* @deprecated Use {@link lookup} instead
* @param hd Hebrew date or R.D. days
*/
get(hd: HDate | number): string[];
/**
* Looks up parsha for the date, then returns a translated or transliterated string
* @deprecated Use {@link lookup} instead
* @param hd Hebrew date or R.D. days
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
*/
getString(hd: HDate | number, locale?: string): string;
/**
* Checks to see if this day would be a regular parasha HaShavua
* Torah reading or special holiday reading
* @deprecated Use {@link lookup} instead
* @param hd Hebrew date or R.D. days
*/
isParsha(hd: HDate | number): boolean;
/**
* Returns the date that a parsha occurs
* or `null` if the parsha doesn't occur this year
* @param parsha if a `string`, specified with Sephardic transliterations
* like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
* array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
* be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative
* number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)
*/
find(parsha: number | string | string[]): HDate | null;
private findInternal;
/**
* Returns the date that a parsha (or its doubled or undoubled counterpart)
* occurs, or `null` if the parsha doesn't occur this year
*/
findContaining(parsha: number | string): HDate | null;
/**
* Returns the underlying annual sedra schedule.
* Used by `@hebcal/triennial`
*/
getSedraArray(): readonly NumberOrString[];
/**
* R.D. date of the first Saturday on or after Rosh Hashana
*/
getFirstSaturday(): number;
getYear(): number;
/**
* Returns an object describing the parsha on the first Saturday on or after `hd`
* @param hd Hebrew date or R.D. days
*/
lookup(hd: HDate | number): SedraResult;
}
/**
* The 54 parshiyot of the Torah as transilterated strings.
* parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[52] == "Ha'azinu".
* @readonly
* @type {string[]}
*/
export declare const parshiot: readonly string[];
type NumberOrString = number | string;
/**
* Convenience function to create an instance of `Sedra` or reuse a previously
* created and cached instance.
* @param hyear
* @param il
*/
export declare function getSedra(hyear: number, il: boolean): Sedra;
export {};