UNPKG

@hebcal/core

Version:

A perpetual Jewish Calendar API

190 lines (189 loc) 7.02 kB
import { HDate } from '@hebcal/hdate'; import './locale'; /** * Holiday flags for Event. These flags are typically * combined using bitwise arithmetic to form a mask. * @readonly * @enum {number} */ export declare const flags: { /** Chag, yontiff, yom tov */ readonly CHAG: 1; /** Light candles 18 minutes before sundown */ readonly LIGHT_CANDLES: 2; /** End of holiday (end of Yom Tov) */ readonly YOM_TOV_ENDS: 4; /** Observed only in the Diaspora (chutz l'aretz) */ readonly CHUL_ONLY: 8; /** Observed only in Israel */ readonly IL_ONLY: 16; /** Light candles in the evening at Tzeit time (3 small stars) */ readonly LIGHT_CANDLES_TZEIS: 32; /** Candle-lighting for Chanukah */ readonly CHANUKAH_CANDLES: 64; /** Rosh Chodesh, beginning of a new Hebrew month */ readonly ROSH_CHODESH: 128; /** Minor fasts like Tzom Tammuz, Ta'anit Esther, ... */ readonly MINOR_FAST: 256; /** Shabbat Shekalim, Zachor, ... */ readonly SPECIAL_SHABBAT: 512; /** Weekly sedrot on Saturdays */ readonly PARSHA_HASHAVUA: 1024; /** Daily page of Talmud (Bavli) */ readonly DAF_YOMI: 2048; /** Days of the Omer */ readonly OMER_COUNT: 4096; /** Yom HaShoah, Yom HaAtzma'ut, ... */ readonly MODERN_HOLIDAY: 8192; /** Yom Kippur and Tish'a B'Av */ readonly MAJOR_FAST: 16384; /** On the Saturday before Rosh Chodesh */ readonly SHABBAT_MEVARCHIM: 32768; /** Molad */ readonly MOLAD: 65536; /** Yahrzeit or Hebrew Anniversary */ readonly USER_EVENT: 131072; /** Daily Hebrew date ("11th of Sivan, 5780") */ readonly HEBREW_DATE: 262144; /** A holiday that's not major, modern, rosh chodesh, or a fast day */ readonly MINOR_HOLIDAY: 524288; /** Evening before a major or minor holiday */ readonly EREV: 1048576; /** Chol haMoed, intermediate days of Pesach or Sukkot */ readonly CHOL_HAMOED: 2097152; /** Mishna Yomi */ readonly MISHNA_YOMI: 4194304; /** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */ readonly YOM_KIPPUR_KATAN: 8388608; /** Daily page of Jerusalem Talmud (Yerushalmi) */ readonly YERUSHALMI_YOMI: 16777216; /** Nach Yomi */ readonly NACH_YOMI: 33554432; /** Daily Learning */ readonly DAILY_LEARNING: 67108864; /** Yizkor */ readonly YIZKOR: 134217728; }; /** * Represents an Event with a title, date, and flags. * * Events are used to represent holidays, candle-lighting times, * Torah readings, and more. * * To get the title of the event a language other than English * with Sephardic transliterations, use the `render()` method. */ export declare class Event { /** Hebrew date of this event */ readonly date: HDate; /** * Untranslated title of this event. Note that these description * strings are always in English and will remain stable across releases. * To get the title of the event in another language, use the * `render()` method. */ readonly desc: string; /** Bitmask of optional event flags. See {@link flags} */ readonly mask: number; /** Optional emoji character such as ✡️, 🕯️, 🕎, 🕍, 🌒 */ emoji?: string; /** Optional longer description or memo text */ memo?: string; /** Alarms are used by iCalendar feeds */ alarm?: Date | string | boolean; /** * Constructs Event * @param date Hebrew date event occurs * @param desc Description (not translated) * @param [mask=0] optional bitmask of holiday flags (see {@link flags}) * @param [attrs={}] optional additional attributes (e.g. `eventTimeStr`, `cholHaMoedDay`) */ constructor(date: HDate, desc: string, mask?: number, attrs?: object); /** * Hebrew date of this event */ getDate(): HDate; /** * Untranslated title of this event. Note that these description * strings are always in English and will remain stable across releases. * To get the title of the event in another language, use the * `render()` method. */ getDesc(): string; /** * Bitmask of optional event flags. See {@link flags} */ getFlags(): number; /** * Returns (translated) description of this event * @example * const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG); * ev.render('en'); // 'Shavuot' * ev.render('he'); // 'שָׁבוּעוֹת' * ev.render('ashkenazi'); // 'Shavuos' * @param [locale] Optional locale name (defaults to active locale). */ render(locale?: string): string; /** * Returns a brief (translated) description of this event. * For most events, this is the same as render(). For some events, it procudes * a shorter text (e.g. without a time or added description). * @param [locale] Optional locale name (defaults to active locale). */ renderBrief(locale?: string): string; /** * Optional holiday-specific Emoji or `null`. */ getEmoji(): string | null; /** * Returns a simplified (untranslated) description for this event. For example, * the `HolidayEvent` class supports * "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot". * For many holidays the basename and the event description are the same. */ basename(): string; /** * Returns a URL to hebcal.com or sefaria.org for more detail on the event. * Returns `undefined` for events with no detail page. */ url(): string | undefined; /** * Is this event observed in Israel? * @example * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); * ev1.observedInIsrael(); // false * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); * ev2.observedInIsrael(); // true */ observedInIsrael(): boolean; /** * Is this event observed in the Diaspora? * @example * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); * ev1.observedInDiaspora(); // true * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); * ev2.observedInDiaspora(); // true */ observedInDiaspora(): boolean; /** * Is this event observed in Israel/Diaspora? * @example * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); * ev1.observedIn(false); // true * ev1.observedIn(true); // false * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); * ev2.observedIn(false); // true * ev2.observedIn(true); // true * @param il */ observedIn(il: boolean): boolean; /** * Makes a clone of this Event object * @deprecated */ clone(): Event; /** * Returns a list of event categories */ getCategories(): string[]; }