Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@hebcal/core
Advanced tools
Hebcal is a perpetual Jewish Calendar. This library converts between Hebrew and Gregorian dates, and generates lists of Jewish holidays for any year (past, present or future). Shabbat and holiday candle lighting and havdalah times are approximated based on location. Torah readings (Parashat HaShavua), Daf Yomi, and counting of the Omer can also be specified. Hebcal also includes algorithms to calculate yahrzeits, birthdays and anniversaries.
Hebcal was created in 1994 by Danny Sadinoff as a Unix/Linux program
written in C, inspired by similar functionality written in Emacs
Lisp. The initial JavaScript port was released in 2014 by Eyal
Schachter (age 15). This ECMAScript 2015 implementation was released
in 2020 by Michael J. Radwin. @hebcal/core
targets both
browser-based JavaScript and server-side Node.js.
Many users of this library will utilize the HebrewCalendar and HDate interfaces.
$ npm install @hebcal/core
import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
const options = {
year: 1981,
isHebrewYear: false,
candlelighting: true,
location: Location.lookup('San Francisco'),
sedrot: true,
omer: true,
};
const events = HebrewCalendar.calendar(options);
for (const ev of events) {
const hd = ev.getDate();
const date = hd.greg();
console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
}
A locale in Hebcal is used for translations/transliterations of
holidays. @hebcal/core
supports four locales by default
en
- default, Sephardic transliterations (e.g. "Shabbat")ashkenazi
- Ashkenazi transliterations (e.g. "Shabbos")he
- Hebrew (e.g. "שַׁבָּת")he-x-NoNikud
- Hebrew without nikud (e.g. "שבת")Represents a Hebrew date
Represents an Event with a title, date, and flags
Daily Hebrew date ("11th of Sivan, 5780")
A class that contains location information such as latitude and longitude required for astronomical calculations. The elevation field may not be used by some calculation engines and would be ignored if set. Check the documentation for specific implementations of the AstronomicalCalculator to see if elevation is calculated as part of the algorithm.
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.
Class representing Location
Calculate halachic times (zmanim / זְמַנִּים) for a given day and location. Calculations are available for tzeit / tzais (nightfall), shkiah (sunset) and more.
Zmanim are estimated using an algorithm published by the US National Oceanic and Atmospheric Administration. The NOAA solar calculator is based on equations from Astronomical Algorithms by Jean Meeus.
The sunrise and sunset results are theoretically accurate to within a minute for locations between +/- 72° latitude, and within 10 minutes outside of those latitudes. However, due to variations in atmospheric composition, temperature, pressure and conditions, observed values may vary from calculations. https://gml.noaa.gov/grad/solcalc/calcdetails.html
An event that has an eventTime
and eventTimeStr
Havdalah after Shabbat or holiday
Candle lighting before Shabbat or holiday
Represents a molad, the moment when the new moon is "born"
Represents a Molad announcement on Shabbat Mevarchim
Represents a day 1-49 of counting the Omer from Pesach to Shavuot
Represents Parashah HaShavua for an entire Hebrew year
Represents one of 54 weekly Torah portions, always on a Saturday
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
Represents Rosh Chodesh, the beginning of a new month
Because Asara B'Tevet often occurs twice in the same Gregorian year,
we subclass HolidayEvent to override the url()
method.
Represents Mevarchim haChodesh, the announcement of the new month
Plug-ins for daily learning calendars such as Daf Yomi, Mishna Yomi, Nach Yomi, etc.
Learning schedules are provided by the @hebcal/learning
package.
HebrewCalendar is the main interface to the @hebcal/core
library.
This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
Event names can be rendered in several languges using the locale
option.
Gregorian date helper functions.
Array.<string>
The 54 parshiyot of the Torah as transilterated strings parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[53] == "Ha'azinu".
string
Converts a numerical value to a string of Hebrew letters.
When specifying years of the Hebrew calendar in the present millennium, we omit the thousands (which is presently 5 [ה]).
number
Converts a string of Hebrew letters to a numerical value.
Only considers the value of Hebrew letters א
through ת
.
Ignores final Hebrew letters such as ך
(kaf sofit) or ם
(mem sofit)
and vowels (nekudot).
number
Converts Hebrew date to R.D. (Rata Die) fixed days. R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian Calendar.
SimpleHebrewDate
Converts absolute R.D. days to Hebrew date
boolean
Returns true if Hebrew year is a leap year
number
Number of months in this Hebrew year (either 12 or 13 depending on leap year)
number
Number of days in Hebrew month in a given year (29 or 30)
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
number
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
number
Number of days in the hebrew YEAR. A common Hebrew calendar year can have a length of 353, 354 or 355 days A leap Hebrew calendar year can have a length of 383, 384 or 385 days
boolean
true if Cheshvan is long in Hebrew year
boolean
true if Kislev is short in Hebrew year
Date
Calculates yahrzeit.
hyear
must be after original date
of death.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The customary anniversary date of a death is more complicated and depends also on the character of the year in which the first anniversary occurs. There are several cases:
Date
Calculates a birthday or anniversary (non-yahrzeit).
hyear
must be after original date
of anniversary.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The birthday of someone born in Adar of an ordinary year or Adar II of a leap year is also always in the last month of the year, be that Adar or Adar II. The birthday in an ordinary year of someone born during the first 29 days of Adar I in a leap year is on the corresponding day of Adar; in a leap year, the birthday occurs in Adar I, as expected.
Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I has his birthday postponed until the first of the following month in years where that day does not occur. [Calendrical Calculations p. 111]
Object
Result of Sedra.lookup
Object
Options to configure which events are returned
Object
A locale in Hebcal is used for translations/transliterations of
holidays. @hebcal/core
supports four locales by default
en
- default, Sephardic transliterations (e.g. "Shabbat")ashkenazi
- Ashkenazi transliterations (e.g. "Shabbos")he
- Hebrew (e.g. "שַׁבָּת")he-x-NoNikud
- Hebrew without nikud (e.g. "שבת")Kind: global class
string
string
LocaleData
string
Array.<string>
string
string
string
Returns translation only if locale
offers a non-empty translation for id
.
Otherwise, returns undefined
.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
id | string | Message ID to translate |
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
By default, if no translation was found, returns id
.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
id | string | Message ID to translate |
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
Register locale translations.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e.: 'he' , 'fr' ) |
data | LocaleData | parsed data from a .po file. |
Adds a translation to locale
, replacing any previous translation.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e: 'he' , 'fr' ). |
id | string | Message ID to translate |
translation | string | Translation text |
Adds multiple translations to locale
, replacing any previous translations.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e: 'he' , 'fr' ). |
data | LocaleData | parsed data from a .po file. |
LocaleData
Activates a locale. Throws an error if the locale has not been previously added. After setting the locale to be used, all strings marked for translations will be represented by the corresponding translation in the specified locale.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e: 'he' , 'fr' ) |
string
Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
Kind: static method of Locale
Array.<string>
Returns the names of registered locales
Kind: static method of Locale
string
Kind: static method of Locale
Param | Type | Description |
---|---|---|
n | number | |
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
Removes nekudot from Hebrew string
Kind: static method of Locale
Param | Type |
---|---|
str | string |
Represents a Hebrew date
Kind: global class
number
boolean
number
number
number
number
number
Date
number
string
string
string
HDate
HDate
HDate
HDate
HDate
HDate
HDate
HDate
HDate
number
boolean
string
number
boolean
number
number
string
number
number
boolean
boolean
number
number
boolean
HDate
Create a Hebrew date. There are 3 basic forms for the HDate()
constructor.
Date
- represents the Hebrew date corresponding to the Gregorian date using
local time. Hours, minutes, seconds and milliseconds are ignored.HDate
- clones a copy of the given Hebrew datenumber
- Converts absolute R.D. days to Hebrew date.
R.D. 1 == the imaginary date January 1, 1 (Gregorian)Param | Type | Description |
---|---|---|
[day] | number | Date | HDate | Day of month (1-30) if a number . If a Date is specified, represents the Hebrew date corresponding to the Gregorian date using local time. If an HDate is specified, clones a copy of the given Hebrew date. |
[month] | number | string | Hebrew month of year (1=NISAN, 7=TISHREI) |
[year] | number | Hebrew year |
Example
import {HDate, months} from '@hebcal/core';
const hd1 = new HDate();
const hd2 = new HDate(new Date(2008, 10, 13));
const hd3 = new HDate(15, 'Cheshvan', 5769);
const hd4 = new HDate(15, months.CHESHVAN, 5769);
const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
const monthName = 'אייר';
const hd6 = new HDate(5, monthName, 5773);
number
Gets the Hebrew year of this Hebrew date
Kind: instance method of HDate
boolean
Tests if this date occurs during a leap year
Kind: instance method of HDate
number
Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
Kind: instance method of HDate
number
The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
Kind: instance method of HDate
number
Number of days in the month of this Hebrew date
Kind: instance method of HDate
number
Gets the day within the month (1-30)
Kind: instance method of HDate
number
Gets the day of the week. 0=Sunday, 6=Saturday
Kind: instance method of HDate
Date
Converts to Gregorian date
Kind: instance method of HDate
number
Returns R.D. (Rata Die) fixed days. R.D. 1 == Monday, January 1, 1 (Gregorian) Note also that R.D. = Julian Date − 1,721,424.5 https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
Kind: instance method of HDate
string
Returns a transliterated Hebrew month name, e.g. 'Elul'
or 'Cheshvan'
.
Kind: instance method of HDate
string
Renders this Hebrew date as a translated or transliterated string,
including ordinal e.g. '15th of Cheshvan, 5769'
.
Kind: instance method of HDate
Param | Type | Default | Description |
---|---|---|---|
[locale] | string | null | Optional locale name (defaults to active locale). |
[showYear] | boolean | true | Display year (defaults to true). |
Example
import {HDate, months} from '@hebcal/core';
const hd = new HDate(15, months.CHESHVAN, 5769);
console.log(hd.render('en')); // '15th of Cheshvan, 5769'
console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
string
Renders this Hebrew date in Hebrew gematriya, regardless of locale.
Kind: instance method of HDate
Param | Type | Default |
---|---|---|
[suppressNikud] | boolean | false |
Example
import {HDate, months} from '@hebcal/core';
const hd = new HDate(15, months.CHESHVAN, 5769);
console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
HDate
Returns an HDate
representing the a dayNumber before the current date.
Sunday=0, Saturday=6
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
Example
new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
HDate
Returns an HDate
representing the a dayNumber on or before the current date.
Sunday=0, Saturday=6
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
dow | number | day of week |
Example
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
HDate
Returns an HDate
representing the nearest dayNumber to the current date
Sunday=0, Saturday=6
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
dow | number | day of week |
Example
new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
HDate
Returns an HDate
representing the a dayNumber on or after the current date.
Sunday=0, Saturday=6
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
dow | number | day of week |
Example
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
HDate
Returns an HDate
representing the a dayNumber after the current date.
Sunday=0, Saturday=6
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
Example
new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
HDate
Returns the next Hebrew date
Kind: instance method of HDate
HDate
Returns the previous Hebrew date
Kind: instance method of HDate
HDate
Returns a cloned HDate
object with a specified amount of time added
Units are case insensitive, and support plural and short forms. Note, short forms are case sensitive.
Unit | Shorthand | Description |
---|---|---|
day | d | days |
week | w | weeks |
month | M | months |
year | y | years |
Kind: instance method of HDate
Param | Type | Default |
---|---|---|
number | number | |
[units] | string | "d" |
HDate
Returns a cloned HDate
object with a specified amount of time subracted
Units are case insensitive, and support plural and short forms. Note, short forms are case sensitive.
Unit | Shorthand | Description |
---|---|---|
day | d | days |
week | w | weeks |
month | M | months |
year | y | years |
Kind: instance method of HDate
Param | Type | Default |
---|---|---|
number | number | |
[units] | string | "d" |
Example
import {HDate, months} from '@hebcal/core';
const hd1 = new HDate(15, months.CHESHVAN, 5769);
const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
number
Returns the difference in days between the two given HDates.
The result is positive if this
date is comes chronologically
after the other
date, and negative
if the order of the two dates is reversed.
The result is zero if the two dates are identical.
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
other | HDate | Hebrew date to compare |
Example
import {HDate, months} from '@hebcal/core';
const hd1 = new HDate(25, months.KISLEV, 5770);
const hd2 = new HDate(15, months.CHESHVAN, 5769);
const days = hd1.deltaDays(hd2); // 394
boolean
Compares this date to another date, returning true
if the dates match.
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
other | HDate | Hebrew date to compare |
string
Kind: instance method of HDate
number
Converts Hebrew date to R.D. (Rata Die) fixed days. R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian Calendar.
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
month | number | Hebrew month |
day | number | Hebrew date (1-30) |
boolean
Returns true if Hebrew year is a leap year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Number of months in this Hebrew year (either 12 or 13 depending on leap year)
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Number of days in Hebrew month in a given year (29 or 30)
Kind: static method of HDate
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
string
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
Kind: static method of HDate
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
number
Returns the Hebrew month number (NISAN=1, TISHREI=7)
Kind: static method of HDate
Param | Type | Description |
---|---|---|
month | number | string | A number, or Hebrew month name string |
number
Number of days in the hebrew YEAR
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Cheshvan is long in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Kislev is short in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Converts Hebrew month string name to numeric
Kind: static method of HDate
Param | Type | Description |
---|---|---|
monthName | string | monthName |
number
Note: Applying this function to d+6 gives us the DAYNAME on or after an absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to absolute date d, applying it to d-1 gives the DAYNAME previous to absolute date d, and applying it to d+7 gives the DAYNAME following absolute date d.
Kind: static method of HDate
Param | Type |
---|---|
dayOfWeek | number |
absdate | number |
boolean
Tests if the object is an instance of HDate
Kind: static method of HDate
Param | Type |
---|---|
obj | any |
HDate
Construct a new instance of HDate
from a Gematriya-formatted string
Kind: static method of HDate
Param | Type | Default |
---|---|---|
str | string | |
currentThousands | number | 5000 |
Example
HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
Represents an Event with a title, date, and flags
Kind: global class
HDate
string
number
string
string
string
string
string
boolean
boolean
boolean
Event
Array.<string>
Constructs Event
Param | Type | Default | Description |
---|---|---|---|
date | HDate | Hebrew date event occurs | |
desc | string | Description (not translated) | |
[mask] | number | 0 | optional bitmask of holiday flags (see flags) |
[attrs] | Object | {} | optional additional attributes (e.g. eventTimeStr , cholHaMoedDay ) |
HDate
Hebrew date of this event
Kind: instance method of Event
string
Untranslated description of this event
Kind: instance method of Event
number
Bitmask of optional event flags. See flags
Kind: instance method of Event
string
Returns (translated) description of this event
Kind: instance method of Event
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Example
const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
ev.render('en'); // 'Shavuot'
ev.render('he'); // 'שָׁבוּעוֹת'
ev.render('ashkenazi'); // 'Shavuos'
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).
Kind: instance method of Event
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Optional holiday-specific Emoji or null
.
Kind: instance method of Event
string
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.
Kind: instance method of Event
string
Returns a URL to hebcal.com or sefaria.org for more detail on the event.
Returns undefined
for events with no detail page.
Kind: instance method of Event
boolean
Is this event observed in Israel?
Kind: instance method of Event
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
boolean
Is this event observed in the Diaspora?
Kind: instance method of Event
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
boolean
Is this event observed in Israel/Diaspora?
Kind: instance method of Event
Param | Type |
---|---|
il | boolean |
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
Event
Makes a clone of this Event object
Kind: instance method of Event
Array.<string>
Returns a list of event categories
Kind: instance method of Event
Daily Hebrew date ("11th of Sivan, 5780")
Kind: global class
Param | Type |
---|---|
date | HDate |
string
Kind: instance method of HebrewDateEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Example
import {HDate, HebrewDateEvent, months} from '@hebcal/core';
const hd = new HDate(15, months.CHESHVAN, 5769);
const ev = new HebrewDateEvent(hd);
console.log(ev.render('en')); // '15th of Cheshvan, 5769'
console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
string
Kind: instance method of HebrewDateEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Example
import {HDate, HebrewDateEvent, months} from '@hebcal/core';
const hd = new HDate(15, months.CHESHVAN, 5769);
const ev = new HebrewDateEvent(hd);
console.log(ev.renderBrief()); // '15th of Cheshvan'
console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'
A class that contains location information such as latitude and longitude required for astronomical calculations. The elevation field may not be used by some calculation engines and would be ignored if set. Check the documentation for specific implementations of the AstronomicalCalculator to see if elevation is calculated as part of the algorithm.
Kind: global class
Version: 1.1
Author: © Eliyahu Hershfeld 2004 - 2016
GeoLocation constructor with parameters for all required fields.
Param | Type | Description |
---|---|---|
name | string | The location name for display use such as "Lakewood, NJ" |
latitude | number | the latitude in a double format such as 40.095965 for Lakewood, NJ. Note: For latitudes south of the equator, a negative value should be used. |
longitude | number | double the longitude in a double format such as -74.222130 for Lakewood, NJ. Note: For longitudes east of the Prime Meridian (Greenwich), a negative value should be used. |
elevation | number | the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating sunrise and set. |
timeZoneId | string | the TimeZone for the location. |
number
Method to get the elevation in Meters.
Kind: instance method of GeoLocation
Returns: number
- Returns the elevation in Meters.
Method to set the elevation in Meters above sea level.
Kind: instance method of GeoLocation
Param | Type | Description |
---|---|---|
elevation | number | The elevation to set in Meters. An IllegalArgumentException will be thrown if the value is a negative. |
number
Kind: instance method of GeoLocation
Returns: number
- Returns the latitude.
number
Kind: instance method of GeoLocation
Returns: number
- Returns the longitude.
string
| null
Kind: instance method of GeoLocation
Returns: string
| null
- Returns the location name.
Kind: instance method of GeoLocation
Param | Type | Description |
---|---|---|
name | string | null | The setter method for the display name. |
string
Kind: instance method of GeoLocation
Returns: string
- Returns the timeZone.
Method to set the TimeZone. If this is ever set after the GeoLocation is set in the AstronomicalCalendar, it is critical that AstronomicalCalendar#getCalendar(). setTimeZone(TimeZone) be called in order for the AstronomicalCalendar to output times in the expected offset. This situation will arise if the AstronomicalCalendar is ever cloned.
Kind: instance method of GeoLocation
Param | Type | Description |
---|---|---|
timeZone | string | The timeZone to set. |
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.
Kind: global class
See: #setAstronomicalCalculator(AstronomicalCalculator) for changing the calculator class.
Author: © Eliyahu Hershfeld 2011 - 2019
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
number
number
number
number
number
number
number
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
Temporal.ZonedDateTime
| null
number
number
A constructor that takes in geolocation information as a parameter. The default AstronomicalCalculator used for solar calculations is the the NOAACalculator.
Param | Type | Description |
---|---|---|
geoLocation | GeoLocation | The location information used for calculating astronomical sun times. |
date | Temporal.PlainDate |
Temporal.ZonedDateTime
| null
The getSunrise method Returns a Date
representing the
elevation adjusted sunrise time. The zenith used
for the calculation uses geometric zenith of 90° plus
AstronomicalCalculator#getElevationAdjustment(double). This is adjusted by the
AstronomicalCalculator to add approximately 50/60 of a degree to account for 34 archminutes of refraction
and 16 archminutes for the sun's radius for a total of 90.83333°.
See documentation for the specific implementation of the AstronomicalCalculator that you are using.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- the Date
representing the exact sunrise time. If the calculation can't be computed such as
in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
does not set, a null will be returned. See detailed explanation on top of the page.
See
Temporal.ZonedDateTime
| null
A method that returns the sunrise without elevation adjustment. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns sunrise calculated at sea level. This forms the base for dawn calculations that are calculated as a dip below the horizon before sunrise.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- the Date
representing the exact sea-level sunrise time. If the calculation can't be computed
such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
where it does not set, a null will be returned. See detailed explanation on top of the page.
See
Temporal.ZonedDateTime
| null
A method that returns the beginning of civil twilight (dawn) using a zenith of 96°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
of the beginning of civil twilight using a zenith of 96°. If the calculation
can't be computed, null will be returned. See detailed explanation on top of the page.
See: #CIVIL_ZENITH
Temporal.ZonedDateTime
| null
A method that returns the beginning of nautical twilight using a zenith of 102°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- 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 detailed explanation on top of the page.
See: #NAUTICAL_ZENITH
Temporal.ZonedDateTime
| null
A method that returns the beginning of astronomical twilight using a zenith of 108°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- 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
Temporal.ZonedDateTime
| null
The getSunset method Returns a Date
representing the
elevation adjusted sunset time. The zenith used for
the calculation uses geometric zenith of 90° plus
AstronomicalCalculator#getElevationAdjustment(double). This is adjusted by the
AstronomicalCalculator to add approximately 50/60 of a degree to account for 34 archminutes of refraction
and 16 archminutes for the sun's radius for a total of 90.83333°.
See documentation for the specific implementation of the AstronomicalCalculator that you are using. Note:
In certain cases the calculates sunset will occur before sunrise. This will typically happen when a timezone
other than the local timezone is used (calculating Los Angeles sunset using a GMT timezone for example). In this
case the sunset date will be incremented to the following date.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
representing the exact sunset time. If the calculation can't be computed such as in
the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
does not set, a null will be returned. See detailed explanation on top of the page.
See
Temporal.ZonedDateTime
| null
A method that returns the sunset without elevation adjustment. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns sunset calculated at sea level. This forms the base for dusk calculations that are calculated as a dip below the horizon after sunset.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
representing the exact sea-level sunset time. If the calculation can't be computed
such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
where it does not set, a null will be returned. See detailed explanation on top of the page.
See
Temporal.ZonedDateTime
| null
A method that returns the end of civil twilight using a zenith of 96°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
of the end of civil twilight using a zenith of 96°. If
the calculation can't be computed, null will be returned. See detailed explanation on top of the page.
See: #CIVIL_ZENITH
Temporal.ZonedDateTime
| null
A method that returns the end of nautical twilight using a zenith of 102°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- 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 detailed explanation on top of the
page.
See: #NAUTICAL_ZENITH
Temporal.ZonedDateTime
| null
A method that returns the end of astronomical twilight using a zenith of 108°.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- 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 detailed explanation on top
of the page.
See: #ASTRONOMICAL_ZENITH
Temporal.ZonedDateTime
| null
A utility method that returns the time of an offset by degrees below or above the horizon of sunrise. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset of 14 + #GEOMETRIC_ZENITH = 104 would have to be passed as a parameter.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
of the offset after (or before) #getSunrise(). If the calculation
can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does
not rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
page.
Param | Type | Description |
---|---|---|
offsetZenith | number | the degrees before #getSunrise() to use in the calculation. For time after sunrise use negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset of 14 + #GEOMETRIC_ZENITH = 104 would have to be passed as a parameter. |
Temporal.ZonedDateTime
| null
A utility method that returns the time of an offset by degrees below or above the horizon of sunset. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset of 14 + #GEOMETRIC_ZENITH = 104 would have to be passed as a parameter.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
of the offset after (or before) #getSunset(). If the calculation can't
be computed such as in the Arctic Circle where there is at least one day a year where the sun does not
rise, and one where it does not set, a null will be returned. See detailed explanation on top of the
page.
Param | Type | Description |
---|---|---|
offsetZenith | number | the degrees after #getSunset() to use in the calculation. For time before sunset use negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset of 14 + #GEOMETRIC_ZENITH = 104 would have to be passed as a parameter. |
number
A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time.
Kind: instance method of NOAACalculator
Returns: number
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set, Double#NaN will be returned. See detailed explanation on top of the page.
Param | Type | Description |
---|---|---|
zenith | number | the degrees below the horizon. For time after sunrise use negative numbers. |
number
A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns UTC sunrise calculated at sea level. This forms the base for dawn calculations that are calculated as a dip below the horizon before sunrise.
Kind: instance method of NOAACalculator
Returns: number
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set, Double#NaN will be returned. See detailed explanation on top of the page.
See
Param | Type | Description |
---|---|---|
zenith | number | the degrees below the horizon. For time after sunrise use negative numbers. |
number
A method that returns the sunset in UTC time without correction for time zone offset from GMT and without using daylight savings time.
Kind: instance method of NOAACalculator
Returns: number
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set, Double#NaN will be returned. See detailed explanation on top of the page.
See: AstronomicalCalendar#getUTCSeaLevelSunset
Param | Type | Description |
---|---|---|
zenith | number | the degrees below the horizon. For time after sunset use negative numbers. |
number
A method that returns the sunset in UTC time without correction for elevation, time zone offset from GMT and without using daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns UTC sunset calculated at sea level. This forms the base for dusk calculations that are calculated as a dip below the horizon after sunset.
Kind: instance method of NOAACalculator
Returns: number
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set, Double#NaN will be returned. See detailed explanation on top of the page.
See
Param | Type | Description |
---|---|---|
zenith | number | the degrees below the horizon. For time before sunset use negative numbers. |
number
Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon used at sea level. This is only used for sunrise and sunset and not times before or after it such as nautical twilight since those calculations are based on the level of available light at the given dip below the horizon, something that is not affected by elevation, the adjustment should only made if the zenith == 90° adjusted for refraction and solar radius. The algorithm used is
elevationAdjustment = Math.toDegrees(Math.acos(earthRadiusInMeters / (earthRadiusInMeters + elevationMeters)));
The source of this algorithm is Calendrical Calculations by Edward M. Reingold and Nachum Dershowitz. An alternate algorithm that produces an almost identical (but not accurate) result found in Ma'aglay Tzedek by Moishe Kosower and other sources is:
elevationAdjustment = 0.0347 * Math.sqrt(elevationMeters);
Kind: instance method of NOAACalculator
Returns: number
- the adjusted zenith
Param | Type | Description |
---|---|---|
elevation | number | elevation in Meters. |
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 (this can be changed via the #setSolarRadius(double) method , and atmospheric refraction accounts for 34 minutes or so (this can be changed via the #setRefraction(double) method), 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° below the zenith. This is traditionally calculated with none of the above mentioned adjustments. The same goes for various tzais and alos times such as the 16.1° dip used in ComplexZmanimCalendar#getAlos16Point1Degrees().
Kind: instance method of NOAACalculator
Returns: number
- The zenith adjusted to include the sun's radius, refraction and elevation adjustment. This will only be adjusted for
sunrise and sunset (if the zenith == 90°)
See: #getElevationAdjustment(double)
Param | Type | Description |
---|---|---|
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 AstronomicalCalendar#getEndNauticalTwilight() that passes AstronomicalCalendar#NAUTICAL_ZENITH to this method. |
elevation | number | elevation in Meters. |
Kind: instance method of NOAACalculator
See: AstronomicalCalculator#getUTCSunrise(Calendar, GeoLocation, double, boolean)
Kind: instance method of NOAACalculator
See: AstronomicalCalculator#getUTCSunset(Calendar, GeoLocation, double, boolean)
number
A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset passed as parameters to this method. An example of the use of this method would be the calculation of a non-elevation adjusted temporal hour by passing in sea level sunrise and sea level sunset as parameters.
Kind: instance method of NOAACalculator
Returns: number
- the long
millisecond length of the temporal hour. If the calculation can't be computed a
Long#MIN_VALUE will be returned. See detailed explanation on top of the page.
See: #getTemporalHour()
Param | Type | Description |
---|---|---|
startOfDay | Temporal.ZonedDateTime | null | The start of the day. |
endOfDay | Temporal.ZonedDateTime | null | The end of the day. |
Temporal.ZonedDateTime
| null
A method that returns sundial or solar noon. It occurs when the Sun is transiting the celestial meridian. In this class it is calculated as halfway between the sunrise and sunset passed to this method. This time can be slightly off the real transit time due to changes in declination (the lengthening or shortening day).
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date
representing Sun's transit. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set, null will be returned. See detailed explanation on top of the page.
Param | Type | Description |
---|---|---|
startOfDay | Temporal.ZonedDateTime | null | the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or any arbitrary start of day) passed to this method. |
endOfDay | Temporal.ZonedDateTime | null | the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any arbitrary end of day) passed to this method. |
Temporal.ZonedDateTime
| null
A method that returns a Date
from the time passed in as a parameter.
Kind: instance method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- The Date.
Access: protected
Param | Type | Description |
---|---|---|
time | number | The time to be set as the time for the Date . The time expected is in the format: 18.75 for 6:45:00 PM. |
isSunrise | boolean | true if the time is sunrise, and false if it is sunset |
Sun's zenith at civil twilight (96°).
Kind: static property of NOAACalculator
Sun's zenith at nautical twilight (102°).
Kind: static property of NOAACalculator
Sun's zenith at astronomical twilight (108°).
Kind: static property of NOAACalculator
Temporal.ZonedDateTime
| null
A utility method that returns a date offset by the offset time passed in. Please note that the level of light during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or after sunset with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed to this method should be sea level sunrise and sunset.
Kind: static method of NOAACalculator
Returns: Temporal.ZonedDateTime
| null
- the Date
with the offset in milliseconds added to it
Param | Type | Description |
---|---|---|
time | Temporal.ZonedDateTime | null | the start time |
offset | number | the offset in milliseconds to add to the time. |
number
Return the Solar Elevation for the horizontal coordinate system at the given location at the given time. Can be negative if the sun is below the horizon. Not corrected for altitude.
Kind: static method of NOAACalculator
Returns: number
- solar elevation in degrees - horizon is 0 degrees, civil twilight is -6 degrees
Param | Type | Description |
---|---|---|
date | Temporal.ZonedDateTime | time of calculation |
lat | number | latitude of location for calculation |
lon | number | longitude of location for calculation |
number
Return the Solar Azimuth for the horizontal coordinate system at the given location at the given time. Not corrected for altitude. True south is 0 degrees.
Kind: static method of NOAACalculator
Param | Type | Description |
---|---|---|
date | Temporal.ZonedDateTime | time of calculation |
latitude | number | latitude of location for calculation |
lon | number | longitude of location for calculation |
Class representing Location
Kind: global class
boolean
string
string
string
string
Intl.DateTimeFormat
string
string
Location
string
string
boolean
Initialize a Location instance
Param | Type | Description |
---|---|---|
latitude | number | Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003) |
longitude | number | Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005) |
il | boolean | in Israel (true) or Diaspora (false) |
tzid | string | Olson timezone ID, e.g. "America/Chicago" |
cityName | string | optional descriptive city name |
countryCode | string | ISO 3166 alpha-2 country code (e.g. "FR") |
[geoid] | string | optional string or numeric geographic ID |
[elevation] | number | in meters (default 0 ) |
boolean
Kind: instance method of Location
string
Kind: instance method of Location
string
Returns the location name, up to the first comma
Kind: instance method of Location
string
Kind: instance method of Location
string
Kind: instance method of Location
Intl.DateTimeFormat
Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
Kind: instance method of Location
string
Kind: instance method of Location
string
Kind: instance method of Location
Location
Creates a location object from one of 60 "classic" Hebcal city names. The following city names are supported: 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva', 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest', 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland', 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa', 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg', 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles', 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City', 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City', 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix', 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg', 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney', 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains', 'Washington DC', 'Worcester'
Kind: static method of Location
Param | Type |
---|---|
name | string |
string
Converts legacy Hebcal timezone to a standard Olson tzid.
Kind: static method of Location
Param | Type | Description |
---|---|---|
tz | number | integer, GMT offset in hours |
dst | string | 'none', 'eu', 'usa', or 'israel' |
string
Converts timezone info from Zip-Codes.com to a standard Olson tzid.
Kind: static method of Location
Param | Type | Description |
---|---|---|
state | string | two-letter all-caps US state abbreviation like 'CA' |
tz | number | positive number, 5=America/New_York, 8=America/Los_Angeles |
dst | string | single char 'Y' or 'N' |
Example
Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
boolean
Adds a location name for Location.lookup()
only if the name isn't
already being used. Returns false
if the name is already taken
and true
if successfully added.
Kind: static method of Location
Param | Type |
---|---|
cityName | string |
location | Location |
Calculate halachic times (zmanim / זְמַנִּים) for a given day and location. Calculations are available for tzeit / tzais (nightfall), shkiah (sunset) and more.
Zmanim are estimated using an algorithm published by the US National Oceanic and Atmospheric Administration. The NOAA solar calculator is based on equations from Astronomical Algorithms by Jean Meeus.
The sunrise and sunset results are theoretically accurate to within a minute for locations between +/- 72° latitude, and within 10 minutes outside of those latitudes. However, due to variations in atmospheric composition, temperature, pressure and conditions, observed values may vary from calculations. https://gml.noaa.gov/grad/solcalc/calcdetails.html
Kind: global class
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
string
Date
string
string
Initialize a Zmanim instance.
Param | Type | Description |
---|---|---|
gloc | GeoLocation | GeoLocation including latitude, longitude, and timezone |
date | Date | HDate | Regular or Hebrew Date. If date is a regular Date , hours, minutes, seconds and milliseconds are ignored. |
Example
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);
const candleLighting = zmanim.sunsetOffset(-18, true);
const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
Date
Convenience function to get the time when sun is above or below the horizon for a certain angle (in degrees).
Kind: instance method of Zmanim
Param | Type |
---|---|
angle | number |
rising | boolean |
Date
Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
Kind: instance method of Zmanim
Date
Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
Kind: instance method of Zmanim
Date
When the upper edge of the Sun disappears below the horizon (0.833° below horizon)
Kind: instance method of Zmanim
Date
When the upper edge of the Sun disappears below the horizon (0.833° below horizon)
Kind: instance method of Zmanim
Date
Civil dawn; Sun is 6° below the horizon in the morning
Kind: instance method of Zmanim
Date
Civil dusk; Sun is 6° below the horizon in the evening
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Midday – Chatzot; Sunrise plus 6 halachic hours
Kind: instance method of Zmanim
Date
Midnight – Chatzot; Sunset plus 6 halachic hours
Kind: instance method of Zmanim
Date
Dawn – Alot haShachar; Sun is 16.1° below the horizon in the morning
Kind: instance method of Zmanim
Date
Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning
Kind: instance method of Zmanim
Date
Earliest talis & tefillin – Misheyakir Machmir; Sun is 10.2° below the horizon in the morning
Kind: instance method of Zmanim
Date
Latest Shema (Gra); Sunrise plus 3 halachic hours, according to the Gra
Kind: instance method of Zmanim
Date
Latest Shacharit (Gra); Sunrise plus 4 halachic hours, according to the Gra
Kind: instance method of Zmanim
Date
Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham
Kind: instance method of Zmanim
Date
Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
Kind: instance method of Zmanim
Date
Earliest Mincha – Mincha Gedola; Sunrise plus 6.5 halachic hours
Kind: instance method of Zmanim
Date
Preferable earliest time to recite Minchah – Mincha Ketana; Sunrise plus 9.5 halachic hours
Kind: instance method of Zmanim
Date
Plag haMincha; Sunrise plus 10.75 halachic hours
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Param | Type | Default | Description |
---|---|---|---|
[angle] | number | 8.5 | optional time for solar depression. Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars. |
Date
Alias for sunrise
Kind: instance method of Zmanim
Date
Alias for sunset
Kind: instance method of Zmanim
Date
Returns sunrise + offset
minutes (either positive or negative).
Kind: instance method of Zmanim
Param | Type | Default | Description |
---|---|---|---|
offset | number | minutes | |
roundMinute | boolean | true | round time to nearest minute (default true) |
seaLevel | boolean | false | use sea-level sunrise (default false) |
Date
Returns sunset + offset
minutes (either positive or negative).
Kind: instance method of Zmanim
Param | Type | Default | Description |
---|---|---|---|
offset | number | minutes | |
roundMinute | boolean | true | round time to nearest minute (default true) |
seaLevel | boolean | false | use sea-level sunset (default false) |
string
Uses timeFormat to return a date like '20:34'
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
timeFormat | Intl.DateTimeFormat |
Date
Discards seconds, rounding to nearest minute.
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
string
Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
Kind: static method of Zmanim
Param | Type |
---|---|
tzid | string |
date | Date |
string
Returns a string like "2022-04-01T13:06:00-11:00"
Kind: static method of Zmanim
Param | Type |
---|---|
tzid | string |
date | Date |
An event that has an eventTime
and eventTimeStr
Kind: global class
string
string
Array.<string>
Param | Type | Description |
---|---|---|
date | HDate | |
desc | string | Description (not translated) |
mask | number | |
eventTime | Date | |
location | Location | |
linkedEvent | Event |
string
Kind: instance method of TimedEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns translation of "Candle lighting" without the time.
Kind: instance method of TimedEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Array.<string>
Kind: instance method of TimedEvent
Havdalah after Shabbat or holiday
Kind: global class
Param | Type |
---|---|
date | HDate |
mask | number |
eventTime | Date |
location | Location |
havdalahMins | number |
linkedEvent | Event |
string
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns translation of "Havdalah" without the time.
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Kind: instance method of HavdalahEvent
Candle lighting before Shabbat or holiday
Kind: global class
Param | Type |
---|---|
date | HDate |
mask | number |
eventTime | Date |
location | Location |
linkedEvent | Event |
string
Kind: instance method of CandleLightingEvent
Represents a molad, the moment when the new moon is "born"
Kind: global class
number
number
string
number
number
number
number
Calculates the molad for a Hebrew month
Param | Type |
---|---|
year | number |
month | number |
number
Kind: instance method of Molad
number
Kind: instance method of Molad
string
Kind: instance method of Molad
number
Kind: instance method of Molad
Returns: number
- Day of Week (0=Sunday, 6=Saturday)
number
Kind: instance method of Molad
Returns: number
- hour of day (0-23)
number
Kind: instance method of Molad
Returns: number
- minutes past hour (0-59)
number
Kind: instance method of Molad
Returns: number
- parts of a minute (0-17)
Represents a Molad announcement on Shabbat Mevarchim
Kind: global class
Param | Type | Description |
---|---|---|
date | HDate | Hebrew date event occurs |
hyear | number | molad year |
hmonth | number | molad month |
string
Kind: instance method of MoladEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Represents a day 1-49 of counting the Omer from Pesach to Shavuot
Kind: global class
string
string
string
string
number
number
string
string
Param | Type |
---|---|
date | HDate |
omerDay | number |
string
Kind: instance method of OmerEvent
Param | Type | Default |
---|---|---|
lang | string | "en" |
string
Kind: instance method of OmerEvent
Todo
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns translation of "Omer day 22" without ordinal numbers.
Kind: instance method of OmerEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Kind: instance method of OmerEvent
number
Kind: instance method of OmerEvent
number
Kind: instance method of OmerEvent
string
Kind: instance method of OmerEvent
Param | Type |
---|---|
locale | string |
string
Kind: instance method of OmerEvent
Represents Parashah HaShavua for an entire Hebrew year
Kind: global class
Array.<string>
string
boolean
HDate
number
number
SedraResult
Caculates the Parashah HaShavua for an entire Hebrew year
Param | Type | Description |
---|---|---|
hebYr | number | Hebrew year (e.g. 5749) |
il | boolean | Use Israel sedra schedule (false for Diaspora) |
Array.<string>
Returns the parsha (or parshiyot) read on Hebrew date
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or R.D. days |
string
Looks up parsha for the date, then returns a translated or transliterated string
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or R.D. days |
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale |
boolean
Checks to see if this day would be a regular parasha HaShavua Torah reading or special holiday reading
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or R.D. days |
HDate
Returns the date that a parsha occurs
Kind: instance method of Sedra
Param | Type |
---|---|
parsha | number | string | Array.<string> |
number
R.D. date of the first Saturday on or after Rosh Hashana
Kind: instance method of Sedra
number
Kind: instance method of Sedra
SedraResult
Returns an object describing the parsha on the first Saturday on or after absdate
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or R.D. days |
Represents one of 54 weekly Torah portions, always on a Saturday
Kind: global class
string
string
string
string
Param | Type | Description |
---|---|---|
date | HDate | |
parsha | Array.<string> | untranslated name of single or double parsha, such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim'] |
il | boolean | |
num | number | Array.<number> |
string
Kind: instance method of ParshaEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
Kind: instance method of ParshaEvent
string
Kind: instance method of ParshaEvent
string
Kind: instance method of ParshaEvent
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
Kind: global class
string
string
string
string
Array.<string>
string
Kind: instance method of HolidayEvent
string
Kind: instance method of HolidayEvent
string
Kind: instance method of HolidayEvent
string
Kind: instance method of HolidayEvent
Array.<string>
Kind: instance method of HolidayEvent
Represents Rosh Chodesh, the beginning of a new month
Kind: global class
string
string
string
Constructs Rosh Chodesh event
Param | Type | Description |
---|---|---|
date | HDate | Hebrew date event occurs |
monthName | string | Hebrew month name (not translated) |
string
Returns (translated) description of this event
Kind: instance method of RoshChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Kind: instance method of RoshChodeshEvent
string
Kind: instance method of RoshChodeshEvent
Because Asara B'Tevet often occurs twice in the same Gregorian year,
we subclass HolidayEvent to override the url()
method.
string
Kind: instance method of AsaraBTevetEvent
Represents Mevarchim haChodesh, the announcement of the new month
Kind: global class
string
string
Constructs Mevarchim haChodesh event
Param | Type | Description |
---|---|---|
date | HDate | Hebrew date event occurs |
monthName | string | Hebrew month name (not translated) |
string
Kind: instance method of MevarchimChodeshEvent
string
Returns (translated) description of this event
Kind: instance method of MevarchimChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Plug-ins for daily learning calendars such as Daf Yomi, Mishna Yomi, Nach Yomi, etc.
Learning schedules are provided by the @hebcal/learning
package.
Kind: global class
Register a new learning calendar.
Kind: static method of DailyLearning
Param | Type |
---|---|
name | string |
calendar | function |
Event
Returns an event from daily calendar for a given date. Returns null
if there
is no learning from this calendar on this date.
Kind: static method of DailyLearning
Param | Type |
---|---|
name | string |
hd | HDate |
HebrewCalendar is the main interface to the @hebcal/core
library.
This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
Event names can be rendered in several languges using the locale
option.
Kind: global class
Array.<Event>
HDate
HDate
Map.<string, Array.<Event>>
Array.<Event>
Array.<Event>
string
string
Sedra
number
TachanunResult
Array.<Event>
Calculates holidays and other Hebrew calendar events based on CalOptions.
Each holiday is represented by an Event object which includes a date, a description, flags and optional attributes. If given no options, returns holidays for the Diaspora for the current Gregorian year.
The date range returned by this function can be controlled by:
options.year
- Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)options.isHebrewYear
- to interpret year
as Hebrew yearoptions.numYears
- generate calendar for multiple years (default 1)options.month
- Gregorian or Hebrew month (to filter results to a single month)Alternatively, specify start and end days with Date
or HDate instances:
options.start
- use specific start date (requires end
date)options.end
- use specific end date (requires start
date)Unless options.noHolidays == true
, default holidays include:
options.noMinorFast
)options.noSpecialShabbat
)options.noModern
)options.noRoshChodesh
)Holiday and Torah reading schedules differ between Israel and the Disapora.
Set options.il=true
to use the Israeli schedule.
Additional non-default event types can be specified:
options.sedrot
)options.omer
)options.shabbatMevarchim
)options.molad
)options.yomKippurKatan
)Daily Study of texts are supported by the @hebcal/learning package, for example:
options.dailyLearning.dafYomi
)options.dailyLearning.yerushalmi
)options.dailyLearning.mishnaYomi
)options.dailyLearning.nachYomi
)Candle-lighting and Havdalah times are approximated using latitude and longitude
specified by the Location class. The Location
class contains a small
database of cities with their associated geographic information and time-zone information.
If you ever have any doubts about Hebcal's times, consult your local halachic authority.
If you enter geographic coordinates above the arctic circle or antarctic circle,
the times are guaranteed to be wrong.
To add candle-lighting options, set options.candlelighting=true
and set
options.location
to an instance of Location
. By default, candle lighting
time is 18 minutes before sundown (40 minutes for Jerusalem,
30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is
calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
are observable in the night time sky with the naked eye). The default Havdalah
option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
These defaults can be changed using these options:
options.candleLightingMins
- minutes before sundown to light candlesoptions.havdalahMins
- minutes after sundown for Havdalah (typical values are 42, 50, or 72).
Havdalah times are suppressed when options.havdalahMins=0
.options.havdalahDeg
- degrees for solar depression for Havdalah.
Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
Havdalah times are suppressed when options.havdalahDeg=0
.If both options.candlelighting=true
and options.location
is specified,
Chanukah candle-lighting times and minor fast start/end times will also be generated.
Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
Saturday night (see above).
Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon in the evening).
Two options also exist for generating an Event with the Hebrew date:
options.addHebrewDates
- print the Hebrew date for the entire date rangeoptions.addHebrewDatesForEvents
- print the Hebrew date for dates with some eventsLastly, translation and transliteration of event titles is controlled by
options.locale
and the Locale API.
@hebcal/core
supports three locales by default:
en
- default, Sephardic transliterations (e.g. "Shabbat")ashkenazi
- Ashkenazi transliterations (e.g. "Shabbos")he
- Hebrew (e.g. "שַׁבָּת")Additional locales (such as ru
or fr
) are supported by the
@hebcal/locales package
Kind: static method of HebrewCalendar
Param | Type | Default |
---|---|---|
[options] | CalOptions | {} |
Example
import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
const options = {
year: 1981,
isHebrewYear: false,
candlelighting: true,
location: Location.lookup('San Francisco'),
sedrot: true,
omer: true,
};
const events = HebrewCalendar.calendar(options);
for (const ev of events) {
const hd = ev.getDate();
const date = hd.greg();
console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
}
HDate
Calculates a birthday or anniversary (non-yahrzeit).
hyear
must be after original gdate
of anniversary.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The birthday of someone born in Adar of an ordinary year or Adar II of a leap year is also always in the last month of the year, be that Adar or Adar II. The birthday in an ordinary year of someone born during the first 29 days of Adar I in a leap year is on the corresponding day of Adar; in a leap year, the birthday occurs in Adar I, as expected.
Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I has his birthday postponed until the first of the following month in years where that day does not occur. [Calendrical Calculations p. 111]
Kind: static method of HebrewCalendar
Returns: HDate
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
gdate | Date | HDate | Gregorian or Hebrew date of event |
Example
import {HebrewCalendar} from '@hebcal/core';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
HDate
Calculates yahrzeit.
hyear
must be after original gdate
of death.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The customary anniversary date of a death is more complicated and depends also on the character of the year in which the first anniversary occurs. There are several cases:
Kind: static method of HebrewCalendar
Returns: HDate
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
gdate | Date | HDate | Gregorian or Hebrew date of death |
Example
import {HebrewCalendar} from '@hebcal/core';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
Map.<string, Array.<Event>>
Lower-level holidays interface, which returns a Map
of Event
s indexed by
HDate.toString()
. These events must filtered especially for flags.IL_ONLY
or flags.CHUL_ONLY
depending on Israel vs. Diaspora holiday scheme.
Kind: static method of HebrewCalendar
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
Array.<Event>
Returns an array of holidays for the year
Kind: static method of HebrewCalendar
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
il | boolean | use the Israeli schedule for holidays |
Array.<Event>
Returns an array of Events on this date (or undefined if no events)
Kind: static method of HebrewCalendar
Param | Type | Description |
---|---|---|
date | HDate | Date | number | Hebrew Date, Gregorian date, or absolute R.D. day number |
[il] | boolean | use the Israeli schedule for holidays |
string
Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
keep as "20:13" for any other locale/country. Uses CalOptions to determine
locale.
If options.hour12
is false
, locale is ignored and always returns 24-hour time.
If options.hour12
is true
, locale is ignored and always returns 12-hour time.
Kind: static method of HebrewCalendar
Param | Type | Description |
---|---|---|
timeStr | string | original time like "20:30" |
suffix | string | "p" or "pm" or " P.M.". Add leading space if you want it |
options | CalOptions |
string
Kind: static method of HebrewCalendar
Sedra
Convenience function to create an instance of Sedra
or reuse a previously
created and cached instance.
Kind: static method of HebrewCalendar
Param | Type |
---|---|
hyear | number |
il | boolean |
number
Return a number containing information on what Hallel is said on that day.
Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot, Yom Ha'atzmaut, and Yom Yerushalayim.
Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
The number is one of the following values:
0 - No Hallel 1 - Half Hallel 2 - Whole Hallel
Kind: static method of HebrewCalendar
Param | Type |
---|---|
hdate | HDate |
il | boolean |
TachanunResult
Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on hdate
.
Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer, Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah, Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah, Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
In some congregations Tachanun is not said until from Rosh Chodesh Sivan until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini, Yom Ha'atzmaut, and Yom Yerushalayim.
Tachanun is not said at Mincha on days before it is not said at Shacharit.
Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
Kind: static method of HebrewCalendar
Param | Type |
---|---|
hdate | HDate |
il | boolean |
Gregorian date helper functions.
Array.<string>
Long names of the Gregorian months (1='January', 12='December')
Kind: static property of greg
Read only: true
enum
Hebrew months of the year (NISAN=1, TISHREI=7)
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
NISAN | number | 1 | Nissan / ניסן |
IYYAR | number | 2 | Iyyar / אייר |
SIVAN | number | 3 | Sivan / סיון |
TAMUZ | number | 4 | Tamuz (sometimes Tammuz) / תמוז |
AV | number | 5 | Av / אב |
ELUL | number | 6 | Elul / אלול |
TISHREI | number | 7 | Tishrei / תִּשְׁרֵי |
CHESHVAN | number | 8 | Cheshvan / חשון |
KISLEV | number | 9 | Kislev / כסלו |
TEVET | number | 10 | Tevet / טבת |
SHVAT | number | 11 | Sh'vat / שבט |
ADAR_I | number | 12 | Adar or Adar Rishon / אדר |
ADAR_II | number | 13 | Adar Sheini (only on leap years) / אדר ב׳ |
enum
Holiday flags for Event
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
CHAG | number | 1 | Chag, yontiff, yom tov |
LIGHT_CANDLES | number | 2 | Light candles 18 minutes before sundown |
YOM_TOV_ENDS | number | 4 | End of holiday (end of Yom Tov) |
CHUL_ONLY | number | 8 | Observed only in the Diaspora (chutz l'aretz) |
IL_ONLY | number | 16 | Observed only in Israel |
LIGHT_CANDLES_TZEIS | number | 32 | Light candles in the evening at Tzeit time (3 small stars) |
CHANUKAH_CANDLES | number | 64 | Candle-lighting for Chanukah |
ROSH_CHODESH | number | 128 | Rosh Chodesh, beginning of a new Hebrew month |
MINOR_FAST | number | 256 | Minor fasts like Tzom Tammuz, Ta'anit Esther, ... |
SPECIAL_SHABBAT | number | 512 | Shabbat Shekalim, Zachor, ... |
PARSHA_HASHAVUA | number | 1024 | Weekly sedrot on Saturdays |
DAF_YOMI | number | 2048 | Daily page of Talmud (Bavli) |
OMER_COUNT | number | 4096 | Days of the Omer |
MODERN_HOLIDAY | number | 8192 | Yom HaShoah, Yom HaAtzma'ut, ... |
MAJOR_FAST | number | 16384 | Yom Kippur and Tish'a B'Av |
SHABBAT_MEVARCHIM | number | 32768 | On the Saturday before Rosh Chodesh |
MOLAD | number | 65536 | Molad |
USER_EVENT | number | 131072 | Yahrzeit or Hebrew Anniversary |
HEBREW_DATE | number | 262144 | Daily Hebrew date ("11th of Sivan, 5780") |
MINOR_HOLIDAY | number | 524288 | A holiday that's not major, modern, rosh chodesh, or a fast day |
EREV | number | 1048576 | Evening before a major or minor holiday |
CHOL_HAMOED | number | 2097152 | Chol haMoed, intermediate days of Pesach or Sukkot |
MISHNA_YOMI | number | 4194304 | Mishna Yomi |
YOM_KIPPUR_KATAN | number | 8388608 | Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh |
YERUSHALMI_YOMI | number | 16777216 | Daily page of Jerusalem Talmud (Yerushalmi) |
NACH_YOMI | number | 33554432 | Nach Yomi |
Array.<string>
The 54 parshiyot of the Torah as transilterated strings parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[53] == "Ha'azinu".
Kind: global constant
Read only: true
string
Converts a numerical value to a string of Hebrew letters.
When specifying years of the Hebrew calendar in the present millennium, we omit the thousands (which is presently 5 [ה]).
Kind: global function
Param | Type |
---|---|
number | number |
Example
gematriya(5774) // 'תשע״ד' - cropped to 774
gematriya(25) // 'כ״ה'
gematriya(60) // 'ס׳'
gematriya(3761) // 'ג׳תשס״א'
gematriya(1123) // 'א׳קכ״ג'
number
Converts a string of Hebrew letters to a numerical value.
Only considers the value of Hebrew letters א
through ת
.
Ignores final Hebrew letters such as ך
(kaf sofit) or ם
(mem sofit)
and vowels (nekudot).
Kind: global function
Param | Type |
---|---|
str | string |
number
Converts Hebrew date to R.D. (Rata Die) fixed days. R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian Calendar.
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
month | number | Hebrew month |
day | number | Hebrew date (1-30) |
SimpleHebrewDate
Converts absolute R.D. days to Hebrew date
Kind: global function
Param | Type | Description |
---|---|---|
abs | number | absolute R.D. days |
boolean
Returns true if Hebrew year is a leap year
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Number of months in this Hebrew year (either 12 or 13 depending on leap year)
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Number of days in Hebrew month in a given year (29 or 30)
Kind: global function
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
Kind: global function
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
number
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Number of days in the hebrew YEAR. A common Hebrew calendar year can have a length of 353, 354 or 355 days A leap Hebrew calendar year can have a length of 383, 384 or 385 days
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Cheshvan is long in Hebrew year
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Kislev is short in Hebrew year
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
Date
Calculates yahrzeit.
hyear
must be after original date
of death.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The customary anniversary date of a death is more complicated and depends also on the character of the year in which the first anniversary occurs. There are several cases:
Kind: global function
Returns: Date
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
date | Date | SimpleHebrewDate | number | Gregorian or Hebrew date of death |
Example
import {getYahrzeit} from '@hebcal/hdate';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const anniversary = getYahrzeit(5780, dt); // '2/25/2020' == '30 Sh\'vat 5780'
Date
Calculates a birthday or anniversary (non-yahrzeit).
hyear
must be after original date
of anniversary.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The birthday of someone born in Adar of an ordinary year or Adar II of a leap year is also always in the last month of the year, be that Adar or Adar II. The birthday in an ordinary year of someone born during the first 29 days of Adar I in a leap year is on the corresponding day of Adar; in a leap year, the birthday occurs in Adar I, as expected.
Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I has his birthday postponed until the first of the following month in years where that day does not occur. [Calendrical Calculations p. 111]
Kind: global function
Returns: Date
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
date | Date | SimpleHebrewDate | number | Gregorian or Hebrew date of event |
Example
import {getBirthdayOrAnniversary} from '@hebcal/hdate';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const anniversary = getBirthdayOrAnniversary(5780, dt); // '3/26/2020' == '1 Nisan 5780'
Object
Result of Sedra.lookup
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
parsha | Array.<string> | Name of the parsha (or parshiyot) read on Hebrew date, e.g. ['Noach'] or ['Matot', 'Masei'] |
chag | boolean | True if this is a regular parasha HaShavua Torah reading, false if it's a special holiday reading |
num | number | Array.<number> | 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] |
Object
Options to configure which events are returned
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
location | Location | latitude/longitude/tzid used for candle-lighting |
year | number | Gregorian or Hebrew year |
isHebrewYear | boolean | to interpret year as Hebrew year |
month | number | Gregorian or Hebrew month (to filter results to a single month) |
numYears | number | generate calendar for multiple years (default 1) |
start | Date | HDate | number | use specific start date (requires end date) |
end | Date | HDate | number | use specific end date (requires start date) |
candlelighting | boolean | calculate candle-lighting and havdalah times |
candleLightingMins | number | minutes before sundown to light candles (default 18) |
havdalahMins | number | minutes after sundown for Havdalah (typical values are 42, 50, or 72). If undefined (the default), calculate Havdalah according to Tzeit Hakochavim - Nightfall (the point when 3 small stars are observable in the night time sky with the naked eye). If 0 , Havdalah times are suppressed. |
havdalahDeg | number | degrees for solar depression for Havdalah. Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899). If 0 , Havdalah times are suppressed. |
fastEndDeg | number | degrees for solar depression for end of fast days. Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky. |
sedrot | boolean | calculate parashah hashavua on Saturdays |
il | boolean | Israeli holiday and sedra schedule |
noMinorFast | boolean | suppress minor fasts |
noModern | boolean | suppress modern holidays |
noRoshChodesh | boolean | suppress Rosh Chodesh |
shabbatMevarchim | boolean | add Shabbat Mevarchim |
noSpecialShabbat | boolean | suppress Special Shabbat |
noHolidays | boolean | suppress regular holidays |
omer | boolean | include Days of the Omer |
molad | boolean | include event announcing the molad |
ashkenazi | boolean | use Ashkenazi transliterations for event titles (default Sephardi transliterations) |
locale | string | translate event titles according to a locale Default value is en , also built-in are he and ashkenazi . Additional locales (such as ru or fr ) are provided by the @hebcal/locales package |
addHebrewDates | boolean | print the Hebrew date for the entire date range |
addHebrewDatesForEvents | boolean | print the Hebrew date for dates with some events |
mask | number | use bitmask from flags to filter events |
yomKippurKatan | boolean | include Yom Kippur Katan (default false ). יוֹם כִּפּוּר קָטָן is a minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh. Yom Kippur Katan is omitted in Elul (on the day before Rosh Hashanah), Tishrei (Yom Kippur has just passed), Kislev (due to Chanukah) and Nisan (fasting not permitted during Nisan). When Rosh Chodesh occurs on Shabbat or Sunday, Yom Kippur Katan is observed on the preceding Thursday. See Wikipedia Yom Kippur Katan practices |
hour12 | boolean | Whether to use 12-hour time (as opposed to 24-hour time). Possible values are true and false ; the default is locale dependent. |
dailyLearning | Object.<string, any> | map of options to enable daily study calendars such as dafYomi , mishnaYomi , nachYomi with value true . For yerushalmi the value should be a number for edition (1 for Vilna, 2 for Schottenstein). |
Object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
shacharit | boolean | Tachanun is said at Shacharit |
mincha | boolean | Tachanun is said at Mincha |
allCongs | boolean | All congregations say Tachanun on the day |
FAQs
A perpetual Jewish Calendar API
The npm package @hebcal/core receives a total of 2,362 weekly downloads. As such, @hebcal/core popularity was classified as popular.
We found that @hebcal/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.