### Event Rendering Examples Source: https://hebcal.github.io/api/learning/classes/DailyRambamEvent Shows how to use the `render` and `renderBrief` methods to get translated descriptions of an event. `render` provides the full description, while `renderBrief` offers a concise version. ```typescript import { HDate } from '@hebcal/core'; // Assuming 'event' is an instance of DailyRambamEvent or a similar Event subclass // const event = new DailyRambamEvent(new HDate(1, 'Tishrei', 5784), RambamReading.MishnehTorah); // Example usage (replace 'event' with an actual event instance) // console.log(event.render('en')); // Get description in English // console.log(event.renderBrief('fr')); // Get brief description in French ``` -------------------------------- ### Install @hebcal/learning Package Source: https://hebcal.github.io/api/learning/index Installs the @hebcal/learning package using npm. This package provides daily learning schedules for use with @hebcal/core. ```bash npm install @hebcal/learning ``` -------------------------------- ### Install @hebcal/noaa Package Source: https://hebcal.github.io/api/noaa/index Installs the @hebcal/noaa package using npm. This is the first step to using the library for sunrise and sunset calculations. ```bash npm install @hebcal/noaa ``` -------------------------------- ### Install @hebcal/hdate using npm Source: https://hebcal.github.io/api/hdate/index Installs the @hebcal/hdate package from npm. This is the first step to using the library in your Node.js or front-end project. ```bash npm install @hebcal/hdate ``` -------------------------------- ### Example Event Observation Source: https://hebcal.github.io/api/learning/classes/PirkeiAvotSummerEvent Demonstrates how to use the `observedIn`, `observedInDiaspora`, and `observedInIsrael` methods with different event types. ```javascript const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); console.log(ev1.observedIn(false)); // true console.log(ev1.observedIn(true)); // false console.log(ev1.observedInDiaspora()); // true console.log(ev1.observedInIsrael()); // false const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); console.log(ev2.observedIn(false)); // true console.log(ev2.observedIn(true)); // true console.log(ev2.observedInDiaspora()); // true console.log(ev2.observedInIsrael()); // true ``` -------------------------------- ### Get Begin Nautical Twilight Source: https://hebcal.github.io/api/core/classes/NOAACalculator Retrieves the start of nautical twilight using a zenith of 102 degrees. Returns a ZonedDateTime object or null if computation fails. ```java getBeginNauticalTwilight(): ZonedDateTime | null ``` -------------------------------- ### DailyRambam3Event Render Example Source: https://hebcal.github.io/api/learning/classes/DailyRambam3Event Provides an example of using the `render` method to get a translated description of the event. An optional locale string can be passed to specify the language. ```typescript // Assuming 'dr3Event' is an instance of DailyRambam3Event // const dr3Event = new DailyRambam3Event(...); const descriptionEn = dr3Event.render(); // Get description in default locale (likely English) const descriptionHe = dr3Event.render('he'); // Get description in Hebrew console.log(descriptionEn); console.log(descriptionHe); ``` -------------------------------- ### PerekYomiEvent Render Example Source: https://hebcal.github.io/api/learning/classes/PerekYomiEvent Provides an example of using the `render` method to get a translated name for the Perek Yomi event, optionally specifying a locale. ```typescript // Assuming 'perekYomiEvent' is an instance of PerekYomiEvent const eventName = perekYomiEvent.render(); // Uses default locale const eventNameHebrew = perekYomiEvent.render('he'); // Explicitly uses Hebrew locale ``` -------------------------------- ### AsaraBTevetEvent render Method Example Source: https://hebcal.github.io/api/core/classes/AsaraBTevetEvent Shows how to use the `render` method to get a translated description of the AsaraBTevetEvent. An optional locale can be provided for different languages. ```typescript import { HDate } from '@hebcal/core'; import { AsaraBTevetEvent } from '@hebcal/core'; const eventDate = new HDate(10, 'Tevet', 5784); const asaraEvent = new AsaraBTevetEvent(eventDate, 'Asara B\'Tevet'); console.log('Event Description (default locale):', asaraEvent.render()); console.log('Event Description (Hebrew locale):', asaraEvent.render('he')); ``` -------------------------------- ### Example Usage of observedIn Methods Source: https://hebcal.github.io/api/learning/classes/DafWeeklyEvent Demonstrates how to use the `observedIn`, `observedInDiaspora`, and `observedInIsrael` methods with different event configurations. ```javascript 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 const ev3 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); ev3.observedInDiaspora(); // true const ev4 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); ev4.observedInDiaspora(); // true const ev5 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY); ev5.observedInIsrael(); // false const ev6 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0); ev6.observedInIsrael(); // true ``` -------------------------------- ### Install @hebcal/rest-api using npm Source: https://hebcal.github.io/api/rest-api/index This command installs the @hebcal/rest-api package, which provides access to Jewish holidays and Hebrew calendar data. It is a prerequisite for using the library's functionalities. ```bash npm install @hebcal/rest-api ``` -------------------------------- ### Install @hebcal/core using npm Source: https://hebcal.github.io/api/core/index This command installs the @hebcal/core package and its dependencies using npm. It is the standard way to add this library to your project. ```bash npm install @hebcal/core ``` -------------------------------- ### Install @hebcal/leyning using npm Source: https://hebcal.github.io/api/leyning/index This command installs the @hebcal/leyning package using npm. It is a prerequisite for using the library in your Javascript projects. ```bash npm install @hebcal/leyning ``` -------------------------------- ### PsalmsEvent Rendering Examples Source: https://hebcal.github.io/api/learning/classes/PsalmsEvent Illustrates how to get different string representations of a PsalmsEvent. `render()` provides the full translated name, while `renderBrief()` offers a concise version, and `basename()` returns a simplified, untranslated description. ```typescript import { HDate } from '@hebcal/core'; import { PsalmsEvent } from '@hebcal/learning'; const d = new HDate(1, 'Tishrei', 5784); const reading = { begin: 1, end: 9 }; const psalmsEvent = new PsalmsEvent(d, reading); // Get the full translated description console.log(`Rendered: ${psalmsEvent.render()}`); // Example output: Rendered: Psalms 1-9 // Get a brief description (often the same as render() for PsalmsEvent) console.log(`Rendered Brief: ${psalmsEvent.renderBrief()}`); // Example output: Rendered Brief: Psalms 1-9 // Get the untranslated basename console.log(`Basename: ${psalmsEvent.basename()}`); // Example output: Basename: Psalms ``` -------------------------------- ### Event Rendering Example (TypeScript) Source: https://hebcal.github.io/api/learning/classes/SeferHaMitzvotEvent Illustrates how to get translated descriptions of an event using the `render` and `renderBrief` methods. The `render` method accepts an optional locale string for translation. ```typescript import { HDate, flags } from '@hebcal/core'; import { Event } from '@hebcal/learning'; // Assuming Event is exported from learning or core const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG); console.log(ev.render('en')); // 'Shavuot' console.log(ev.render('he')); // 'שָׁבוּעוֹת' console.log(ev.render('ashkenazi')); // 'Shavuos' console.log(ev.renderBrief('en')); // 'Shavuot' ``` -------------------------------- ### MishnaYomiEvent Render Example Source: https://hebcal.github.io/api/learning/classes/MishnaYomiEvent Shows how to get a translated name for the MishnaYomiEvent using the `render` method. This method supports localization by accepting an optional locale string. ```typescript import { HDate } from '@hebcal/core'; import { MishnaYomiEvent } from '@hebcal/learning'; // Example MishnaYomiEvent instance (replace with actual data) const date = new HDate(1, 'Nisan', 5784); const mishnaYomiData = []; // Replace with actual MishnaYomi data const mishnaEvent = new MishnaYomiEvent(date, mishnaYomiData); const eventNameEn = mishnaEvent.render('en'); const eventNameHe = mishnaEvent.render('he'); console.log(`Event Name (English): ${eventNameEn}`); console.log(`Event Name (Hebrew): ${eventNameHe}`); ``` -------------------------------- ### Install @hebcal/icalendar Package Source: https://hebcal.github.io/api/icalendar/index Installs the @hebcal/icalendar package using npm. This is the first step to using the library for generating iCalendar feeds. ```bash npm install @hebcal/icalendar ``` -------------------------------- ### PerekYomiEvent URL Example Source: https://hebcal.github.io/api/learning/classes/PerekYomiEvent Demonstrates how to generate a URL to the Sefaria.org entry for the Perek Yomi event using the `url` method. ```typescript // Assuming 'perekYomiEvent' is an instance of PerekYomiEvent const sefariaUrl = perekYomiEvent.url(); console.log(sefariaUrl); ``` -------------------------------- ### ShemiratHaLashonEvent Constructor Example Source: https://hebcal.github.io/api/learning/classes/ShemiratHaLashonEvent Demonstrates how to instantiate a ShemiratHaLashonEvent. It requires an HDate object and a ShemiratHaLashonReading object. ```typescript import { HDate } from '@hebcal/core'; import { ShemiratHaLashonEvent, ShemiratHaLashonReading } from '@hebcal/learning'; const date = new HDate(1, 'Tishrei', 5784); const reading: ShemiratHaLashonReading = { /* ... reading data ... */ }; const shemiratEvent = new ShemiratHaLashonEvent(date, reading); ``` -------------------------------- ### makeLeyningSummary Function Source: https://hebcal.github.io/api/leyning/functions/makeLeyningSummary Generates a concise summary of the leyning based on the provided AliyotMap. ```APIDOC ## makeLeyningSummary ### Description Makes a summary of the leyning, like "Genesis 6:9-11:32". ### Method Not Applicable (This is a function documentation, not an HTTP endpoint) ### Endpoint Not Applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "aliyot": { "parsha": "Vayikra", "aliyot": [ { "book": "Vayikra", "chapter": 1, "verse": 1 }, { "book": "Vayikra", "chapter": 1, "verse": 2 }, { "book": "Vayikra", "chapter": 1, "verse": 3 }, { "book": "Vayikra", "chapter": 1, "verse": 4 }, { "book": "Vayikra", "chapter": 1, "verse": 5 }, { "book": "Vayikra", "chapter": 1, "verse": 6 }, { "book": "Vayikra", "chapter": 1, "verse": 7 } ] } } ``` ### Response #### Success Response (string) - **summary** (string) - A string representing the leyning summary, e.g., "Vayikra 1:1-7". #### Response Example ```json { "summary": "Vayikra 1:1-7" } ``` ``` -------------------------------- ### DailyLearning Class API Source: https://hebcal.github.io/api/core/classes/DailyLearning Documentation for the DailyLearning class, including its constructors and static methods for managing and querying daily learning calendars. ```APIDOC ## Class DailyLearning Plug-ins for daily learning calendars such as Daf Yomi, Mishna Yomi, Nach Yomi, etc. Learning schedules are provided by the `@hebcal/learning` package. ### Constructor #### `new DailyLearning()` **Description:** Initializes a new instance of the DailyLearning class. **Returns:** `DailyLearning` - A new instance of the DailyLearning class. ## Methods ### `Static` addCalendar #### `addCalendar(name: string, calendar: Function, startDate?: HDate): void` **Description:** Registers a new learning calendar with the DailyLearning system. **Parameters:** * **name** (string) - Required - The name of the calendar (case insensitive). * **calendar** (Function) - Required - A function that returns an `Event` object or `null`. * **startDate** (HDate) - Optional - The first date for which this calendar is valid. **Returns:** `void` ### `Static` getCalendars #### `getCalendars(): string[]` **Description:** Retrieves the names of all currently registered learning calendars. **Returns:** `string[]` - An array of strings, where each string is the name of a registered calendar. ### `Static` getStartDate #### `getStartDate(name: string): HDate | undefined` **Description:** Gets the start date for a specified learning calendar. **Parameters:** * **name** (string) - Required - The name of the calendar. **Returns:** `HDate | undefined` - The start date of the calendar, or `undefined` if not found. ### `Static` has #### `has(name: string): boolean` **Description:** Checks if a learning calendar with the given name has been registered. **Parameters:** * **name** (string) - Required - The name of the calendar to check (case insensitive). **Returns:** `boolean` - `true` if the calendar is registered, `false` otherwise. ### `Static` lookup #### `lookup(name: string, hd: HDate, il: boolean): Event | null` **Description:** Retrieves an event from a daily learning calendar for a specific date. **Parameters:** * **name** (string) - Required - The name of the calendar (case insensitive). * **hd** (HDate) - Required - The Hebrew Date for which to look up the event. * **il** (boolean) - Required - `true` for Israel, `false` for Diaspora. **Returns:** `Event | null` - The event for the given date and location, or `null` if there is no learning from this calendar on that date. ``` -------------------------------- ### Get Event Basename Source: https://hebcal.github.io/api/core/classes/HavdalahEvent Returns a simplified, untranslated description of the event. For example, 'Erev Pesach' becomes 'Pesach'. ```typescript basename(): string ``` -------------------------------- ### Get Begin Civil Twilight Source: https://hebcal.github.io/api/core/classes/NOAACalculator Retrieves the start of civil twilight using a zenith of 96 degrees. Returns a ZonedDateTime object or null if computation fails. ```java getBeginCivilTwilight(): ZonedDateTime | null ``` -------------------------------- ### url Method Example - TypeScript Source: https://hebcal.github.io/api/learning/classes/YerushalmiYomiEvent Shows the `url` method, which returns a string representing a URL to the corresponding page on Sefaria.org, or undefined if no such URL is available for the event. ```typescript url(): undefined | string // Example usage: // const sefariaUrl = yerushalmiEvent.url(); ``` -------------------------------- ### Class Triennial Source: https://hebcal.github.io/api/triennial/classes/Triennial Provides functionality to calculate and retrieve Triennial Torah readings. It allows for debugging, checking Israel mode, getting specific readings, and determining cycle start years. ```APIDOC ## Class Triennial Triennial Torah readings ### Constructor * `new Triennial(hebrewYear?, il?)`: Triennial * Calculates Triennial schedule for entire Hebrew year. #### Parameters * **hebrewYear** (number) - Optional - Hebrew Year (default current year) * **il** (boolean) - Optional - Israel (default false) #### Returns * Triennial ### Methods #### debug * `debug(): string` * Returns debug information as a string. #### Returns * `string` #### getIsrael * `getIsrael(): boolean` * Checks if the current instance is set to Israel mode. #### Returns * `boolean` #### getReading * `getReading(parsha, yearNum): TriennialAliyot` * Retrieves the Triennial reading details for a given parsha and year number in the cycle. #### Parameters * **parsha** (string) - Required - Parsha name (e.g., "Bereshit" or "Achrei Mot-Kedoshim") * **yearNum** (number) - Required - 0 through 2 for which year of Triennial cycle #### Returns * `TriennialAliyot` - Result, including a map of aliyot 1-7 plus "M". #### getStartYear * `getStartYear(): number` * Gets the Hebrew year when the Triennial cycle started for this instance. #### Returns * `number` #### Static Methods ##### getCycleStartYear * `getCycleStartYear(year): number` * Returns the Hebrew year that this 3-year triennial cycle began. #### Parameters * **year** (number) - Required - Hebrew year #### Returns * `number` ##### getYearNumber * `getYearNumber(year): number` * Returns the triennial year (1, 2, or 3) based on the given Hebrew year. #### Parameters * **year** (number) - Required - Hebrew year #### Returns * `number` ``` -------------------------------- ### OmerEvent.sefira Example - TypeScript Source: https://hebcal.github.io/api/core/classes/OmerEvent Illustrates the use of the sefira method to get the Omer count description in different languages or transliterations. It accepts an optional language parameter. ```typescript sefira(lang?: OmerLang): string // Example output for day 8: // 'חֶֽסֶד שֶׁבִּגְבוּרָה' // 'Chesed shebiGevurah' // 'Lovingkindness within Might' ``` -------------------------------- ### CandleLightingEvent render Method Example Source: https://hebcal.github.io/api/core/classes/CandleLightingEvent Shows how to use the `render` method to get a translated description of the event. An optional locale string can be provided to specify the language. ```typescript import { HDate, Location, CalOptions, Event, CandleLightingEvent } from '@hebcal/core'; // Assuming CandleLightingEvent is instantiated as shown previously const date = new HDate(1, 'Tishrei', 5784); const mask = 0; const eventTime = new Date('2023-09-15T18:30:00Z'); const location = { geo: { lat: 31.5, lon: 34.5 }, name: 'Jerusalem' }; const candleLightingEvent = new CandleLightingEvent(date, mask, eventTime, location); console.log(`Event description (default locale): ${candleLightingEvent.render()}`); console.log(`Event description (Hebrew locale): ${candleLightingEvent.render('he')}`); ``` -------------------------------- ### PerekYomiEvent RenderBrief Example Source: https://hebcal.github.io/api/learning/classes/PerekYomiEvent Shows how to use the `renderBrief` method to obtain a concise, translated description of the event. This can be shorter than the full `render` output for certain events. ```typescript // Assuming 'perekYomiEvent' is an instance of PerekYomiEvent const briefName = perekYomiEvent.renderBrief(); // Uses default locale const briefNameSpanish = perekYomiEvent.renderBrief('es'); // Explicitly uses Spanish locale ``` -------------------------------- ### MishnaYomiEvent RenderBrief Example Source: https://hebcal.github.io/api/learning/classes/MishnaYomiEvent Demonstrates the usage of the `renderBrief` method, which provides a concise, translated description of the MishnaYomiEvent. It can be shorter than the full `render` output, omitting times or extra details. ```typescript import { HDate } from '@hebcal/core'; import { MishnaYomiEvent } from '@hebcal/learning'; // Example MishnaYomiEvent instance (replace with actual data) const date = new HDate(1, 'Nisan', 5784); const mishnaYomiData = []; // Replace with actual MishnaYomi data const mishnaEvent = new MishnaYomiEvent(date, mishnaYomiData); const briefDescEn = mishnaEvent.renderBrief('en'); const briefDescHe = mishnaEvent.renderBrief('he'); console.log(`Brief Description (English): ${briefDescEn}`); console.log(`Brief Description (Hebrew): ${briefDescHe}`); ``` -------------------------------- ### Calculate Zmanim using @hebcal/core Source: https://hebcal.github.io/api/core/classes/Zmanim This example demonstrates how to instantiate the Zmanim class and calculate specific halachic times like candle lighting. It requires importing GeoLocation and Zmanim from '@hebcal/core', specifying location coordinates and timezone, and providing a date. The output can be formatted into ISO 8601 strings with timezone information. ```javascript const {GeoLocation, Zmanim} = require('@hebcal/core'); const latitude = 41.822232; const longitude = -71.448292; const tzid = 'America/New_York'; const friday = new Date(2023, 8, 8); const gloc = new GeoLocation(null, latitude, longitude, 0, tzid); const zmanim = new Zmanim(gloc, friday, false); const candleLighting = zmanim.sunsetOffset(-18, true); const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting); ``` -------------------------------- ### Get Tishrei-Based Hebrew Month Source: https://hebcal.github.io/api/core/classes/HDate Returns the Hebrew month based on the Tishrei calendar, where Tishrei is month 1. This is useful for calculations that use Tishrei as the starting month. ```javascript const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769 hd.getTishreiMonth(); // 2 ``` -------------------------------- ### CandleLightingEvent url Method Example Source: https://hebcal.github.io/api/core/classes/CandleLightingEvent Shows how to get a URL for more details about the event from hebcal.com or sefaria.org using the `url` method. Returns `undefined` if no detail page exists. ```typescript import { HDate, Location, CalOptions, Event, CandleLightingEvent } from '@hebcal/core'; // Assuming CandleLightingEvent is instantiated as shown previously const date = new HDate(1, 'Tishrei', 5784); const mask = 0; const eventTime = new Date('2023-09-15T18:30:00Z'); const location = { geo: { lat: 31.5, lon: 34.5 }, name: 'Jerusalem' }; const candleLightingEvent = new CandleLightingEvent(date, mask, eventTime, location); const detailUrl = candleLightingEvent.url(); if (detailUrl) { console.log(`Event detail URL: ${detailUrl}`); } else { console.log('No detail URL available for this event.'); } ``` -------------------------------- ### NOAACalculator Class Documentation Source: https://hebcal.github.io/api/noaa/classes/NOAACalculator Documentation for the NOAACalculator class, including its constructor, properties, and methods for astronomical time calculations. ```APIDOC ## Class NOAACalculator Implementation of sunrise and sunset methods to calculate astronomical times based on the NOAA algorithm. This calculator uses the Java algorithm based on the implementation by NOAA - National Oceanic and Atmospheric Administration's Surface Radiation Research Branch. NOAA's implementation is based on equations from Astronomical Algorithms by Jean Meeus. Added to the algorithm is an adjustment of the zenith to account for elevation. The algorithm can be found in the Wikipedia Sunrise Equation article. #### Author © Eliyahu Hershfeld 2011 - 2019 ### Constructors #### constructor * `new NOAACalculator(geoLocation, date): NOAACalculator` * A constructor that takes in geolocation information as a parameter. #### Parameters * `geoLocation`: GeoLocation - The location information used for calculating astronomical sun times. * `date`: PlainDate #### Returns `NOAACalculator` ### Properties #### `Static` `Readonly` ASTRONOMICAL_ZENITH `ASTRONOMICAL_ZENITH`: number = 108 Sun's zenith at astronomical twilight (108°). #### `Static` `Readonly` CIVIL_ZENITH `CIVIL_ZENITH`: number = 96 Sun's zenith at civil twilight (96°). #### `Static` `Readonly` NAUTICAL_ZENITH `NAUTICAL_ZENITH`: number = 102 Sun's zenith at nautical twilight (102°). ### Methods #### adjustZenith * `adjustZenith(zenith, elevation): number` * Adjusts the zenith of astronomical sunrise and sunset to account for solar refraction, solar radius and elevation. The value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true sunset or sunrise, instead the centre of the Sun's disk must lie just below the horizon for the upper edge to be obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of arc, and atmospheric refraction accounts for 34 minutes or so, giving a total of 50 arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset. Since a person at an elevation can see blow the horizon of a person at sea level, this will also adjust the zenith to account for elevation if available. Note that this will only adjust the value if the zenith is exactly 90 degrees. For values below and above this no correction is done. As an example, astronomical twilight is when the sun is 18° below the horizon or 108°. This is traditionally calculated with none of the above mentioned adjustments. The same goes for various _tzais_ and _alos_ times such as the ZmanimCalendar#ZENITH_16_POINT_1 16.1° dip used in ComplexZmanimCalendar#getAlos16Point1Degrees. #### Parameters * `zenith`: number - The azimuth below the vertical zenith of 90°. For sunset typically the * zenith used for the calculation uses geometric zenith of 90° and adjusts this slightly to account for solar refraction and the sun's radius. Another example would be getEndNauticalTwilight that passes NAUTICAL_ZENITH to this method. * `elevation`: number - elevation in Meters. #### Returns `number` - The zenith adjusted to include the sun's radius, refracton and elevation adjustment. This will only be adjusted for sunrise and sunset (if the zenith == 90°) #### See `getElevationAdjustment` #### getBeginAstronomicalTwilight * `getBeginAstronomicalTwilight(): null | ZonedDateTime` * A method that returns the beginning of astronomical twilight using a zenith of * 108°. #### Returns `null | ZonedDateTime` - The `Date` of the beginning of astronomical twilight using a zenith of 108°. If the calculation can't be computed, null will be returned. See detailed explanation on top of the page. #### See `ASTRONOMICAL_ZENITH` #### getBeginCivilTwilight * `getBeginCivilTwilight(): null | ZonedDateTime` * A method that returns the beginning of civil twilight (dawn) using a zenith of 96°. #### Returns `null | ZonedDateTime` - The `Date` of the beginning of civil twilight (dawn) using a zenith of 96°. If the calculation can't be computed, null will be returned. #### See `CIVIL_ZENITH` #### getBeginNauticalTwilight * `getBeginNauticalTwilight(): null | ZonedDateTime` * A method that returns the beginning of nautical twilight using a zenith of 102°. #### Returns `null | ZonedDateTime` - The `Date` of the beginning of nautical twilight using a zenith of 102°. If the calculation can't be computed, null will be returned. #### See `NAUTICAL_ZENITH` #### getDateFromTime * `getDateFromTime(time: ZonedDateTime): PlainDate` * Converts a ZonedDateTime object to a PlainDate object. #### Parameters * `time`: ZonedDateTime #### Returns `PlainDate` #### getElevationAdjustment * `getElevationAdjustment(elevation: number, zenith: number): number` * Calculates the elevation adjustment for a given elevation and zenith angle. #### Parameters * `elevation`: number - The elevation in meters. * `zenith`: number - The zenith angle in degrees. #### Returns `number` - The calculated elevation adjustment. #### See `adjustZenith` #### getEndAstronomicalTwilight * `getEndAstronomicalTwilight(): null | ZonedDateTime` * A method that returns the end of astronomical twilight using a zenith of 108°. #### Returns `null | ZonedDateTime` - The `Date` of the end of astronomical twilight using a zenith of 108°. If the calculation can't be computed, null will be returned. #### See `ASTRONOMICAL_ZENITH` #### getEndCivilTwilight * `getEndCivilTwilight(): null | ZonedDateTime` * A method that returns the end of civil twilight (dusk) using a zenith of 96°. #### Returns `null | ZonedDateTime` - The `Date` of the end of civil twilight (dusk) using a zenith of 96°. If the calculation can't be computed, null will be returned. #### See `CIVIL_ZENITH` #### getEndNauticalTwilight * `getEndNauticalTwilight(): null | ZonedDateTime` * A method that returns the end of nautical twilight using a zenith of 102°. #### Returns `null | ZonedDateTime` - The `Date` of the end of nautical twilight using a zenith of 102°. If the calculation can't be computed, null will be returned. #### See `NAUTICAL_ZENITH` #### getSeaLevelSunrise * `getSeaLevelSunrise(): null | ZonedDateTime` * A method that returns the sea level sunrise time. #### Returns `null | ZonedDateTime` - The sea level sunrise time. If the calculation can't be computed, null will be returned. #### getSeaLevelSunset * `getSeaLevelSunset(): null | ZonedDateTime` * A method that returns the sea level sunset time. #### Returns `null | ZonedDateTime` - The sea level sunset time. If the calculation can't be computed, null will be returned. #### getSunTransit * `getSunTransit(): null | ZonedDateTime` * A method that returns the sun transit time. #### Returns `null | ZonedDateTime` - The sun transit time. If the calculation can't be computed, null will be returned. #### getSunrise * `getSunrise(): null | ZonedDateTime` * A method that returns the sunrise time. #### Returns `null | ZonedDateTime` - The sunrise time. If the calculation can't be computed, null will be returned. #### getSunriseOffsetByDegrees * `getSunriseOffsetByDegrees(degrees: number): null | ZonedDateTime` * Calculates the sunrise time for a given zenith angle in degrees. #### Parameters * `degrees`: number - The zenith angle in degrees. #### Returns `null | ZonedDateTime` - The sunrise time for the specified zenith angle. If the calculation can't be computed, null will be returned. #### getSunset * `getSunset(): null | ZonedDateTime` * A method that returns the sunset time. #### Returns `null | ZonedDateTime` - The sunset time. If the calculation can't be computed, null will be returned. #### getSunsetOffsetByDegrees * `getSunsetOffsetByDegrees(degrees: number): null | ZonedDateTime` * Calculates the sunset time for a given zenith angle in degrees. #### Parameters * `degrees`: number - The zenith angle in degrees. #### Returns `null | ZonedDateTime` - The sunset time for the specified zenith angle. If the calculation can't be computed, null will be returned. #### getTemporalHour * `getTemporalHour(time: ZonedDateTime): number` * Converts a ZonedDateTime object to a temporal hour. #### Parameters * `time`: ZonedDateTime #### Returns `number` #### getUTCSeaLevelSunrise * `getUTCSeaLevelSunrise(): null | ZonedDateTime` * A method that returns the UTC sea level sunrise time. #### Returns `null | ZonedDateTime` - The UTC sea level sunrise time. If the calculation can't be computed, null will be returned. #### getUTCSeaLevelSunset * `getUTCSeaLevelSunset(): null | ZonedDateTime` * A method that returns the UTC sea level sunset time. #### Returns `null | ZonedDateTime` - The UTC sea level sunset time. If the calculation can't be computed, null will be returned. #### getUTCSunrise * `getUTCSunrise(): null | ZonedDateTime` * A method that returns the UTC sunrise time. #### Returns `null | ZonedDateTime` - The UTC sunrise time. If the calculation can't be computed, null will be returned. #### getUTCSunrise0 * `getUTCSunrise0(): null | ZonedDateTime` * A method that returns the UTC sunrise time adjusted for refraction and the sun's radius. #### Returns `null | ZonedDateTime` - The UTC sunrise time adjusted for refraction and the sun's radius. If the calculation can't be computed, null will be returned. #### getUTCSunset * `getUTCSunset(): null | ZonedDateTime` * A method that returns the UTC sunset time. #### Returns `null | ZonedDateTime` - The UTC sunset time. If the calculation can't be computed, null will be returned. #### getUTCSunset0 * `getUTCSunset0(): null | ZonedDateTime` * A method that returns the UTC sunset time adjusted for refraction and the sun's radius. #### Returns `null | ZonedDateTime` - The UTC sunset time adjusted for refraction and the sun's radius. If the calculation can't be computed, null will be returned. #### getSolarAzimuth * `getSolarAzimuth(time: ZonedDateTime): number` * Calculates the solar azimuth for a given time. #### Parameters * `time`: ZonedDateTime #### Returns `number` #### getSolarElevation * `getSolarElevation(time: ZonedDateTime): number` * Calculates the solar elevation for a given time. #### Parameters * `time`: ZonedDateTime #### Returns `number` #### getTimeOffset * `getTimeOffset(time: ZonedDateTime): number` * Calculates the time offset for a given time. #### Parameters * `time`: ZonedDateTime #### Returns `number` ``` -------------------------------- ### Initialize MishnaYomiIndex Instance Source: https://hebcal.github.io/api/learning/classes/MishnaYomiIndex This constructor initializes a new instance of the MishnaYomiIndex class. It does not take any parameters and returns a MishnaYomiIndex object. ```typescript new MishnaYomiIndex() ``` -------------------------------- ### Get Hebrew Date on or Before a Specific Day of Week Source: https://hebcal.github.io/api/core/classes/HDate Calculates the Hebrew date that falls on or before a specified day of the week, given a starting Hebrew date. This is useful for finding the previous occurrence of a particular weekday. ```javascript new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014 new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014 new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014 ``` -------------------------------- ### Create HDate Instance Source: https://hebcal.github.io/api/core/classes/HDate Demonstrates various ways to instantiate the HDate class. This includes creating a date from the current system time, converting a Gregorian Date object, cloning an existing HDate, converting a Rata Die number, and creating a date using Hebrew day, month, and year. ```javascript import {HDate, months} from '@hebcal/hdate'; const hd1 = new HDate(); // Current Hebrew date const hd2 = new HDate(new Date(2008, 10, 13)); // From Gregorian Date const hd3 = new HDate(15, 'Cheshvan', 5769); // From Hebrew day, month name, year const hd4 = new HDate(15, months.CHESHVAN, 5769); // From Hebrew day, month enum, year const hd5 = new HDate(733359); // From Rata Die number const monthName = 'אייר'; const hd6 = new HDate(5, monthName, 5773); // From Hebrew day, month name, year ``` -------------------------------- ### Get Hebrew Date on or After a Specific Day of Week Source: https://hebcal.github.io/api/core/classes/HDate Calculates the Hebrew date that falls on or after a specified day of the week, given a starting Hebrew date. This is useful for finding the next occurrence of a particular weekday. ```javascript new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014 new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014 new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014 ``` -------------------------------- ### MishnaYomiEvent URL Example Source: https://hebcal.github.io/api/learning/classes/MishnaYomiEvent Shows how to obtain a URL to the Sefaria.org page corresponding to the Mishna Yomi event using the `url` method. This is useful for linking users directly to relevant content. ```typescript import { HDate } from '@hebcal/core'; import { MishnaYomiEvent } from '@hebcal/learning'; // Example MishnaYomiEvent instance (replace with actual data) const date = new HDate(1, 'Nisan', 5784); const mishnaYomiData = []; // Replace with actual MishnaYomi data const mishnaEvent = new MishnaYomiEvent(date, mishnaYomiData); const sefariaUrl = mishnaEvent.url(); console.log(`Sefaria URL: ${sefariaUrl}`); ``` -------------------------------- ### DailyChapterEvent Constructor - TypeScript Source: https://hebcal.github.io/api/learning/classes/DailyChapterEvent Initializes a new DailyChapterEvent object. It requires the Hebrew date, a unique identifier (k), a version number (v), a category string, and a bitmask for event flags. ```typescript new DailyChapterEvent( date: HDate, k: string, v: number, category: string, mask: number ): DailyChapterEvent ``` -------------------------------- ### Get Hebrew Month Number Source: https://hebcal.github.io/api/core/classes/HDate Returns the numeric representation of a Hebrew month, given its name or number. The numbering starts with NISAN as 1 and TISHREI as 7. It accepts a string or number and returns the month number. ```javascript import {HDate, months} from '@hebcal/hdate'; HDate.monthNum(months.CHESHVAN); // 8 HDate.monthNum('Cheshvan'); // 8 HDate.monthNum('חשון'); // 8 ``` -------------------------------- ### getUTCSunrise Source: https://hebcal.github.io/api/core/classes/NOAACalculator Calculates UTC sunrise time for a given date and location, with an option to adjust for elevation. It also allows calculating times based on angles relative to sunrise. ```APIDOC ## GET /api/utcSunrise ### Description A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise. ### Method GET ### Endpoint /api/utcSunrise ### Parameters #### Query Parameters - **date** (PlainDate) - Required - Used to calculate day of year. - **geoLocation** (GeoLocation) - Required - The location information used for astronomical calculating sun times. - **zenith** (number) - Required - The azimuth below the vertical zenith of 90 degrees. for sunrise typically the * zenith used for the calculation uses geometric zenith of 90° and adjusts this slightly to account for solar refraction and the sun's radius. Another example would be getBeginNauticalTwilight that passes NAUTICAL_ZENITH to this method. - **adjustForElevation** (boolean) - Required - Should the time be adjusted for elevation. ### Response #### Success Response (200) - **utcSunriseTime** (number) - The UTC time of sunrise in 24 hour format. 5:45:00 AM will return 5.75.0. Returns NaN if an error was encountered in the calculation. #### Response Example ```json { "utcSunriseTime": 5.75 } ``` ``` -------------------------------- ### Install @hebcal/triennial using npm Source: https://hebcal.github.io/api/triennial/index This command installs the @hebcal/triennial package, which is necessary for utilizing its triennial Torah reading functionalities. Ensure you have Node.js and npm installed on your system. ```bash npm install @hebcal/triennial ```