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.calendar() 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(), hd.toString());
}
- HDate
Represents a Hebrew date
- Event
Represents an Event with a title, date, and flags
- HebrewDateEvent
Daily Hebrew date ("11th of Sivan, 5780")
- Zmanim
Class representing halachic times
- Location
Class representing Location
- TimedEvent
An event that has an
eventTime
andeventTimeStr
- HavdalahEvent
Havdalah after Shabbat or holiday
- CandleLightingEvent
Candle lighting before Shabbat or holiday
- Molad
Represents a molad, the moment when the new moon is "born"
- MoladEvent
Represents a Molad announcement on Shabbat Mevarchim
- OmerEvent
Represents a day 1-49 of counting the Omer from Pesach to Shavuot
- DafYomi
Returns the Daf Yomi for given date
- DafYomiEvent
Event wrapper around a DafYomi instance
- Sedra
Represents Parashah HaShavua for an entire Hebrew year
- ParshaEvent
Represents one of 54 weekly Torah portions, always on a Saturday
- HolidayEvent
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
- RoshChodeshEvent
Represents Rosh Chodesh, the beginning of a new month
- AsaraBTevetEvent
Because Asara B'Tevet often occurs twice in the same Gregorian year, we subclass HolidayEvent to override the
url()
method.- MevarchimChodeshEvent
Represents Mevarchim haChodesh, the announcement of the new month
- MishnaYomiIndex
A program of daily learning in which participants study two Mishnahs each day in order to finish the entire Mishnah in ~6 years.
- MishnaYomiEvent
Event wrapper around a Mishna Yomi instance
- greg :
object
Gregorian date helper functions.
- Locale :
object
A locale in Hebcal is used for translations/transliterations of holidays.
@hebcal/core
supports four locales by defaulten
- default, Sephardic transliterations (e.g. "Shabbat")ashkenazi
- Ashkenazi transliterations (e.g. "Shabbos")he
- Hebrew (e.g. "שַׁבָּת")he-x-NoNikud
- Hebrew without nikud (e.g. "שבת")
- parshiot :
Array.<string>
The 54 parshiyot of the Torah as transilterated strings parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[53] == "Ha'Azinu".
- HebrewCalendar
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 thelocale
option.
- gematriya(number) ⇒
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 [ה]).
- ZmanimTimesResult :
Object
- SedraResult :
Object
Result of Sedra.lookup
- MishnaYomi :
Object
Options to configure which events are returned
Represents a Hebrew date
Kind: global class
- HDate
- new HDate([day], [month], [year])
- instance
- .getFullYear() ⇒
number
- .isLeapYear() ⇒
boolean
- .getMonth() ⇒
number
- .getTishreiMonth() ⇒
number
- .daysInMonth() ⇒
number
- .getDate() ⇒
number
- .getDay() ⇒
number
- .greg() ⇒
Date
- .abs() ⇒
number
- .getMonthName() ⇒
string
- .render([locale], [showYear]) ⇒
string
- .renderGematriya() ⇒
string
- .before(day) ⇒
HDate
- .onOrBefore(dow) ⇒
HDate
- .nearest(dow) ⇒
HDate
- .onOrAfter(dow) ⇒
HDate
- .after(day) ⇒
HDate
- .next() ⇒
HDate
- .prev() ⇒
HDate
- .add(number, [units]) ⇒
HDate
- .subtract(number, [units]) ⇒
HDate
- .deltaDays(other) ⇒
number
- .isSameDate(other) ⇒
boolean
- .toString() ⇒
string
- .getFullYear() ⇒
- static
- .hebrew2abs(year, month, day) ⇒
number
- .isLeapYear(year) ⇒
boolean
- .monthsInYear(year) ⇒
number
- .daysInMonth(month, year) ⇒
number
- .getMonthName(month, year) ⇒
string
- .monthNum(month) ⇒
number
- .elapsedDays(year) ⇒
number
- .daysInYear(year) ⇒
number
- .longCheshvan(year) ⇒
boolean
- .shortKislev(year) ⇒
boolean
- .monthFromName(monthName) ⇒
number
- .dayOnOrBefore(dayOfWeek, absdate) ⇒
number
- .isHDate(obj) ⇒
boolean
- .hebrew2abs(year, month, day) ⇒
Create a Hebrew date. There are 3 basic forms for the HDate()
constructor.
- No parameters - represents the current Hebrew date at time of instantiation
- One parameter
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)
- Three parameters: Hebrew day, Hebrew month, Hebrew year. Hebrew day should be a number between 1-30, Hebrew month can be a number or string, and Hebrew year is always a number.
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);
Gets the Hebrew year of this Hebrew date
Kind: instance method of HDate
Tests if this date occurs during a leap year
Kind: instance method of HDate
Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
Kind: instance method of HDate
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 of days in the month of this Hebrew date
Kind: instance method of HDate
Gets the day within the month (1-30)
Kind: instance method of HDate
Gets the day of the week. 0=Sunday, 6=Saturday
Kind: instance method of HDate
Converts to Gregorian date
Kind: instance method of HDate
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
Returns a transliterated Hebrew month name, e.g. 'Elul'
or 'Cheshvan'
.
Kind: instance method of HDate
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()); // '15th of Cheshvan, 5769'
console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
Renders this Hebrew date in Hebrew gematriya, regardless of locale.
Kind: instance method of HDate
Example
import {HDate, months} from '@hebcal/core';
const hd = new HDate(15, months.CHESHVAN, 5769);
console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
hDate.before(day) ⇒ 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.onOrBefore(dow) ⇒ 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.nearest(dow) ⇒ 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.onOrAfter(dow) ⇒ 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.after(day) ⇒ 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.next() ⇒ HDate
Returns the next Hebrew date
Kind: instance method of HDate
hDate.prev() ⇒ HDate
Returns the previous Hebrew date
Kind: instance method of HDate
hDate.add(number, [units]) ⇒ 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.subtract(number, [units]) ⇒ 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
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
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 |
Kind: instance method of HDate
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) |
Returns true if Hebrew year is a leap year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
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 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 |
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 |
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 |
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Number of days in the hebrew YEAR
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
true if Cheshvan is long in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
true if Kislev is short in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Converts Hebrew month string name to numeric
Kind: static method of HDate
Param | Type | Description |
---|---|---|
monthName | string |
monthName |
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 |
Tests if the object is an instance of HDate
Kind: static method of HDate
Param | Type |
---|---|
obj | any |
Represents an Event with a title, date, and flags
Kind: global class
- Event
- new Event(date, desc, [mask], [attrs])
- .getDate() ⇒
HDate
- .getDesc() ⇒
string
- .getFlags() ⇒
number
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .getEmoji() ⇒
string
- .basename() ⇒
string
- .url() ⇒
string
- .observedInIsrael() ⇒
boolean
- .observedInDiaspora() ⇒
boolean
.getAttrs() ⇒Object
- .clone() ⇒
Event
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 ) |
event.getDate() ⇒ HDate
Hebrew date of this event
Kind: instance method of Event
Untranslated description of this event
Kind: instance method of Event
Bitmask of optional event flags. See flags
Kind: instance method of Event
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(); // 'Shavuot'
ev.render('he'); // 'שָׁבוּעוֹת'
ev.render('ashkenazi'); // 'Shavuos'
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). |
Optional holiday-specific Emoji or null
.
Kind: instance method of Event
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
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
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
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
Deprecated
Kind: instance method of Event
event.clone() ⇒ Event
Makes a clone of this Event object
Kind: instance method of Event
Daily Hebrew date ("11th of Sivan, 5780")
Kind: global class
- HebrewDateEvent
- new HebrewDateEvent(date)
- instance
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .render([locale]) ⇒
- static
Param | Type |
---|---|
date | HDate |
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()); // '15th of Cheshvan, 5769'
console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
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')); // 'ט״ו חֶשְׁוָן'
Deprecated
Helper function to render a Hebrew date
Kind: static method of HebrewDateEvent
Param | Type |
---|---|
day | number |
monthName | string |
fullYear | number |
Class representing halachic times
Kind: global class
- Zmanim
- new Zmanim(date, latitude, longitude)
- instance
.suntime() ⇒ZmanimTimesResult
- .sunrise() ⇒
Date
- .sunset() ⇒
Date
- .dawn() ⇒
Date
- .dusk() ⇒
Date
- .hour() ⇒
number
- .hourMins() ⇒
number
- .gregEve() ⇒
Date
- .nightHour() ⇒
number
- .nightHourMins() ⇒
number
- .hourOffset(hours) ⇒
Date
- .chatzot() ⇒
Date
- .chatzotNight() ⇒
Date
- .alotHaShachar() ⇒
Date
- .misheyakir() ⇒
Date
- .misheyakirMachmir() ⇒
Date
- .sofZmanShma() ⇒
Date
- .sofZmanTfilla() ⇒
Date
- .minchaGedola() ⇒
Date
- .minchaKetana() ⇒
Date
- .plagHaMincha() ⇒
Date
- .tzeit([angle]) ⇒
Date
- .neitzHaChama() ⇒
Date
- .shkiah() ⇒
Date
- .sunsetOffset(offset) ⇒
Date
.sunsetOffsetTime(offset, timeFormat) ⇒Array.<Object>
.tzeitTime(angle, timeFormat) ⇒Array.<Object>
- static
- .formatTime(dt, timeFormat) ⇒
string
- .roundTime(dt) ⇒
Date
- .timeZoneOffset(tzid, date) ⇒
string
- .formatISOWithTimeZone(tzid, date) ⇒
string
- .formatTime(dt, timeFormat) ⇒
Initialize a Zmanim instance.
Param | Type | Description |
---|---|---|
date | Date | HDate |
Regular or Hebrew Date. If date is a regular Date , hours, minutes, seconds and milliseconds are ignored. |
latitude | number |
|
longitude | number |
zmanim.suntime() ⇒ ZmanimTimesResult
ZmanimTimesResult
Deprecated
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Param | Type |
---|---|
hours | number |
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Kind: instance method of Zmanim
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 degress for 3 medium-sized stars. |
Kind: instance method of Zmanim
Kind: instance method of Zmanim
Returns sunset + offset (either positive or negative).
Kind: instance method of Zmanim
Param | Type |
---|---|
offset | number |
Deprecated
Returns an array with sunset + offset Date object, and a 24-hour string formatted time.
Kind: instance method of Zmanim
Param | Type |
---|---|
offset | number |
timeFormat | Intl.DateTimeFormat |
Deprecated
Returns an array with tzeit Date object and a 24-hour string formatted time.
Kind: instance method of Zmanim
Param | Type | Description |
---|---|---|
angle | number |
degrees for solar depression. Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars. |
timeFormat | Intl.DateTimeFormat |
Uses timeFormat to return a date like '20:34'
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
timeFormat | Intl.DateTimeFormat |
Discards seconds, rounding to nearest minute.
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
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 |
Returns a string like "2022-04-01T13:06:00-11:00"
Kind: static method of Zmanim
Param | Type |
---|---|
tzid | string |
date | Date |
Class representing Location
Kind: global class
- Location
- new Location(latitude, longitude, il, tzid, cityName, countryCode, geoid)
- instance
- .getLatitude() ⇒
number
- .getLongitude() ⇒
number
- .getIsrael() ⇒
boolean
- .getName() ⇒
string
- .getShortName() ⇒
string
- .getCountryCode() ⇒
string
- .getTzid() ⇒
string
- .getTimeFormatter() ⇒
Intl.DateTimeFormat
- .getGeoId() ⇒
string
.sunset(hdate) ⇒Date
.tzeit(hdate, [angle]) ⇒Date
- .toString() ⇒
string
- .getLatitude() ⇒
- static
- .lookup(name) ⇒
Location
- .legacyTzToTzid(tz, dst) ⇒
string
- .getUsaTzid(state, tz, dst) ⇒
string
- .geonameCityDescr(cityName, admin1, countryName) ⇒
string
- .addLocation(cityName, location) ⇒
boolean
- .lookup(name) ⇒
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 |
Kind: instance method of Location
Kind: instance method of Location
Kind: instance method of Location
Kind: instance method of Location
Returns the location name, up to the first comma
Kind: instance method of Location
Kind: instance method of Location
Kind: instance method of Location
Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
Kind: instance method of Location
Kind: instance method of Location
Deprecated
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
Deprecated
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
[angle] | number |
Kind: instance method of Location
Location.lookup(name) ⇒ 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 |
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' |
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'
Builds a city description from geonameid string components
Kind: static method of Location
Param | Type | Description |
---|---|---|
cityName | string |
e.g. 'Tel Aviv' or 'Chicago' |
admin1 | string |
e.g. 'England' or 'Massachusetts' |
countryName | string |
full country name, e.g. 'Israel' or 'United States' |
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 |
An event that has an eventTime
and eventTimeStr
Kind: global class
Param | Type | Description |
---|---|---|
date | HDate |
|
desc | string |
Description (not translated) |
mask | number |
|
eventTime | Date |
|
location | Location |
|
linkedEvent | Event |
Kind: instance method of TimedEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
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). |
Havdalah after Shabbat or holiday
Kind: global class
Param | Type |
---|---|
date | HDate |
mask | number |
eventTime | Date |
location | Location |
havdalahMins | number |
linkedEvent | Event |
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Returns translation of "Havdalah" without the time.
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
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 |
Kind: instance method of CandleLightingEvent
Represents a molad, the moment when the new moon is "born"
Kind: global class
- Molad
- new Molad(year, month)
- .getYear() ⇒
number
- .getMonth() ⇒
number
- .getMonthName() ⇒
string
- .getDow() ⇒
number
- .getHour() ⇒
number
- .getMinutes() ⇒
number
- .getChalakim() ⇒
number
Calculates the molad for a Hebrew month
Param | Type |
---|---|
year | number |
month | number |
Kind: instance method of Molad
Kind: instance method of Molad
Kind: instance method of Molad
Kind: instance method of Molad
Returns: number
- Day of Week (0=Sunday, 6=Saturday)
Kind: instance method of Molad
Returns: number
- hour of day (0-23)
Kind: instance method of Molad
Returns: number
- minutes past hour (0-59)
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 |
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
- OmerEvent
- new OmerEvent(date, omerDay)
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .getEmoji() ⇒
string
- .getWeeks() ⇒
number
- .getDaysWithinWeeks() ⇒
number
- .getTodayIs(locale) ⇒
string
Param | Type |
---|---|
date | HDate |
omerDay | number |
Kind: instance method of OmerEvent
Todo
- use gettext()
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Returns translation of "Omer 22" without ordinal numbers.
Kind: instance method of OmerEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Kind: instance method of OmerEvent
Kind: instance method of OmerEvent
Kind: instance method of OmerEvent
Kind: instance method of OmerEvent
Param | Type |
---|---|
locale | string |
Returns the Daf Yomi for given date
Kind: global class
- DafYomi
- new DafYomi(gregdate)
- .getBlatt() ⇒
number
- .getName() ⇒
string
- .render([locale]) ⇒
string
Initializes a daf yomi instance
Param | Type | Description |
---|---|---|
gregdate | Date | HDate | number |
Gregorian date |
Kind: instance method of DafYomi
Kind: instance method of DafYomi
Formats (with translation) the dafyomi result as a string like "Pesachim 34"
Kind: instance method of DafYomi
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Event wrapper around a DafYomi instance
Kind: global class
- DafYomiEvent
- new DafYomiEvent(date)
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .url() ⇒
string
Param | Type |
---|---|
date | HDate |
Returns Daf Yomi name including the 'Daf Yomi: ' prefix (e.g. "Daf Yomi: Pesachim 107").
Kind: instance method of DafYomiEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Returns Daf Yomi name without the 'Daf Yomi: ' prefix (e.g. "Pesachim 107").
Kind: instance method of DafYomiEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Returns a link to sefaria.org or dafyomi.org
Kind: instance method of DafYomiEvent
Represents Parashah HaShavua for an entire Hebrew year
Kind: global class
- Sedra
- new Sedra(hebYr, il)
- .get(hDate) ⇒
Array.<string>
- .getString(hDate, [locale]) ⇒
string
- .isParsha(hDate) ⇒
boolean
- .find(parsha) ⇒
HDate
- .getFirstSaturday() ⇒
number
- .getYear() ⇒
number
- .lookup(hDate) ⇒
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) |
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 |
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 |
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 |
sedra.find(parsha) ⇒ HDate
Returns the date that a parsha occurs
Kind: instance method of Sedra
Param | Type |
---|---|
parsha | number | string | Array.<string> |
R.D. date of the first Saturday on or after Rosh Hashana
Kind: instance method of Sedra
Kind: instance method of Sedra
sedra.lookup(hDate) ⇒ 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
- ParshaEvent
- new ParshaEvent(date, parsha, il)
- .render([locale]) ⇒
string
- .basename() ⇒
string
- .url() ⇒
string
- .urlDateSuffix() ⇒
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 |
Kind: instance method of ParshaEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
Kind: instance method of ParshaEvent
Kind: instance method of ParshaEvent
Kind: instance method of ParshaEvent
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
Kind: global class
- HolidayEvent
- new HolidayEvent(date, desc, [mask], [attrs])
- .basename() ⇒
string
- .url() ⇒
string
- .urlDateSuffix() ⇒
string
- .getEmoji() ⇒
string
Constructs Holiday event
Param | Type | Default | Description |
---|---|---|---|
date | HDate |
Hebrew date event occurs | |
desc | string |
Description (not translated) | |
[mask] | number |
0 |
optional holiday flags |
[attrs] | Object |
{} |
Kind: instance method of HolidayEvent
Kind: instance method of HolidayEvent
Kind: instance method of HolidayEvent
Kind: instance method of HolidayEvent
Represents Rosh Chodesh, the beginning of a new month
Kind: global class
- RoshChodeshEvent
- new RoshChodeshEvent(date, monthName)
- .render([locale]) ⇒
string
- .basename() ⇒
string
- .getEmoji() ⇒
string
Constructs Rosh Chodesh event
Param | Type | Description |
---|---|---|
date | HDate |
Hebrew date event occurs |
monthName | string |
Hebrew month name (not translated) |
Returns (translated) description of this event
Kind: instance method of RoshChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Kind: instance method of RoshChodeshEvent
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.
Kind: global class
Constructs AsaraBTevetEvent
Param | Type | Default | Description |
---|---|---|---|
date | HDate |
Hebrew date event occurs | |
desc | string |
Description (not translated) | |
[mask] | number |
0 |
optional holiday flags |
[attrs] | Object |
{} |
Kind: instance method of AsaraBTevetEvent
Represents Mevarchim haChodesh, the announcement of the new month
Kind: global class
Constructs Mevarchim haChodesh event
Param | Type | Description |
---|---|---|
date | HDate |
Hebrew date event occurs |
monthName | string |
Hebrew month name (not translated) |
Returns (translated) description of this event
Kind: instance method of MevarchimChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
A program of daily learning in which participants study two Mishnahs each day in order to finish the entire Mishnah in ~6 years.
Kind: global class
Initializes a Mishna Yomi instance
mishnaYomiIndex.days : Array.<MishnaYomi>
Kind: instance property of MishnaYomiIndex
mishnaYomiIndex.lookup(date) ⇒ Array.<MishnaYomi>
Looks up a Mishna Yomi
Kind: instance method of MishnaYomiIndex
Param | Type | Description |
---|---|---|
date | Date | HDate | number |
Gregorian date |
Event wrapper around a Mishna Yomi instance
Kind: global class
- MishnaYomiEvent
- new MishnaYomiEvent(date, mishnaYomi)
- .render([locale]) ⇒
string
- .url() ⇒
string
Param | Type |
---|---|
date | HDate |
mishnaYomi | Array.<MishnaYomi> |
Returns Mishna Yomi name (e.g. "Bava Metzia 10:5-6" or "Berakhot 9:5-Peah 1:1").
Kind: instance method of MishnaYomiEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
Returns a link to sefaria.org
Kind: instance method of MishnaYomiEvent
Gregorian date helper functions.
Kind: global namespace
- greg :
object
- .monthNames :
Array.<string>
- .isLeapYear(year) ⇒
boolean
- .daysInMonth(month, year) ⇒
number
- .isDate(obj) ⇒
boolean
- .dayOfYear(date) ⇒
number
- .greg2abs(date) ⇒
number
- .abs2greg(theDate) ⇒
Date
- .monthNames :
Long names of the Gregorian months (1='January', 12='December')
Kind: static property of greg
Read only: true
Returns true if the Gregorian year is a leap year
Kind: static method of greg
Param | Type | Description |
---|---|---|
year | number |
Gregorian year |
Number of days in the Gregorian month for given year
Kind: static method of greg
Param | Type | Description |
---|---|---|
month | number |
Gregorian month (1=January, 12=December) |
year | number |
Gregorian year |
Returns true if the object is a Javascript Date
Kind: static method of greg
Param | Type |
---|---|
obj | Object |
Returns number of days since January 1 of that year
Kind: static method of greg
Param | Type | Description |
---|---|---|
date | Date |
Gregorian date |
Converts Gregorian date to absolute R.D. (Rata Die) days
Kind: static method of greg
Param | Type | Description |
---|---|---|
date | Date |
Gregorian date |
Converts from Rata Die (R.D. number) to Gregorian date. See the footnote on page 384 of ``Calendrical Calculations, Part II: Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M. Clamen, Software--Practice and Experience, Volume 23, Number 4 (April, 1993), pages 383-404 for an explanation.
Kind: static method of greg
Param | Type | Description |
---|---|---|
theDate | number |
R.D. number of days |
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 namespace
- Locale :
object
- .lookupTranslation(id, [locale]) ⇒
string
- .gettext(id, [locale]) ⇒
string
- .addLocale(locale, data)
- .useLocale(locale) ⇒
LocaleData
- .getLocaleName() ⇒
string
- .getLocaleNames() ⇒
Array.<string>
- .ordinal(n, [locale]) ⇒
string
- .hebrewStripNikkud(str) ⇒
string
- .lookupTranslation(id, [locale]) ⇒
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. |
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 | LocaleDate |
parsed data from a .po file. |
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' ) |
Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
Kind: static method of Locale
Returns the names of registered locales
Kind: static method of Locale
Kind: static method of Locale
Param | Type | Description |
---|---|---|
n | number |
|
[locale] | string |
Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
Removes nekudot from Hebrew string
Kind: static method of Locale
Param | Type |
---|---|
str | string |
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) / אדר ב׳ |
Holiday flags for Event
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
CHAG | number |
CHAG$1 |
Chag, yontiff, yom tov |
LIGHT_CANDLES | number |
LIGHT_CANDLES$2 |
Light candles 18 minutes before sundown |
YOM_TOV_ENDS | number |
YOM_TOV_ENDS$2 |
End of holiday (end of Yom Tov) |
CHUL_ONLY | number |
CHUL_ONLY$2 |
Observed only in the Diaspora (chutz l'aretz) |
IL_ONLY | number |
IL_ONLY$2 |
Observed only in Israel |
LIGHT_CANDLES_TZEIS | number |
LIGHT_CANDLES_TZEIS$2 |
Light candles in the evening at Tzeit time (3 small stars) |
CHANUKAH_CANDLES | number |
CHANUKAH_CANDLES$2 |
Candle-lighting for Chanukah |
ROSH_CHODESH | number |
ROSH_CHODESH$1 |
Rosh Chodesh, beginning of a new Hebrew month |
MINOR_FAST | number |
MINOR_FAST$2 |
Minor fasts like Tzom Tammuz, Ta'anit Esther, ... |
SPECIAL_SHABBAT | number |
SPECIAL_SHABBAT$2 |
Shabbat Shekalim, Zachor, ... |
PARSHA_HASHAVUA | number |
PARSHA_HASHAVUA$1 |
Weekly sedrot on Saturdays |
DAF_YOMI | number |
DAF_YOMI$1 |
Daily page of Talmud |
OMER_COUNT | number |
OMER_COUNT$1 |
Days of the Omer |
MODERN_HOLIDAY | number |
MODERN_HOLIDAY$2 |
Yom HaShoah, Yom HaAtzma'ut, ... |
MAJOR_FAST | number |
MAJOR_FAST$2 |
Yom Kippur and Tish'a B'Av |
SHABBAT_MEVARCHIM | number |
SHABBAT_MEVARCHIM$1 |
On the Saturday before Rosh Chodesh |
MOLAD | number |
MOLAD |
Molad |
USER_EVENT | number |
USER_EVENT |
Yahrzeit or Hebrew Anniversary |
HEBREW_DATE | number |
HEBREW_DATE |
Daily Hebrew date ("11th of Sivan, 5780") |
MINOR_HOLIDAY | number |
MINOR_HOLIDAY$2 |
A holiday that's not major, modern, rosh chodesh, or a fast day |
EREV | number |
EREV$2 |
Evening before a major or minor holiday |
CHOL_HAMOED | number |
CHOL_HAMOED$2 |
Chol haMoed, intermediate days of Pesach or Sukkot |
MISHNA_YOMI | number |
MISHNA_YOMI |
Mishna Yomi |
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
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 constant
- HebrewCalendar
- .calendar([options]) ⇒
Array.<Event>
- .getBirthdayOrAnniversary(hyear, gdate) ⇒
HDate
- .getYahrzeit(hyear, gdate) ⇒
HDate
- .getHolidaysForYear(year) ⇒
Map.<string, Array.<Event>>
- .getHolidaysForYearArray(year, il) ⇒
Array.<Event>
- .getHolidaysOnDate(date, [il]) ⇒
Array.<Event>
- .reformatTimeStr(timeStr, suffix, options) ⇒
string
- .version() ⇒
string
- .getSedra(hyear, il) ⇒
Sedra
- .Options :
Object
- .calendar([options]) ⇒
HebrewCalendar.calendar([options]) ⇒ Array.<Event>
Calculates holidays and other Hebrew calendar events based on Options.
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 interpretyear
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 (requiresend
date)options.end
- use specific end date (requiresstart
date)
Unless options.noHolidays == true
, default holidays include:
- Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
- Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
- Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless
options.noMinorFast
) - Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless
options.noSpecialShabbat
) - Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless
options.noModern
) - Rosh Chodesh (unless
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:
- Parashat HaShavua - weekly Torah Reading on Saturdays (
options.sedrot
) - Counting of the Omer (
options.omer
) - Daf Yomi (
options.dafyomi
) - Mishna Yomi (
options.mishnaYomi
) - Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (
options.shabbatMevarchim
) - Molad announcement on Saturday before Rosh Chodesh (
options.molad
)
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) 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 supressed whenoptions.havdalahMins=0
.options.havdalahDeg
- degrees for solar depression for Havdalah. Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars. Havdalah times are supressed whenoptions.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 events
Lastly, 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] | Options |
{} |
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(), hd.toString());
}
HebrewCalendar.getBirthdayOrAnniversary(hyear, gdate) ⇒ 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'
HebrewCalendar.getYahrzeit(hyear, gdate) ⇒ 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:
- If the date of death is Marcheshvan 30, the anniversary in general depends on the first anniversary; if that first anniversary was not Marcheshvan 30, use the day before Kislev 1.
- If the date of death is Kislev 30, the anniversary in general again depends on the first anniversary — if that was not Kislev 30, use the day before Tevet 1.
- If the date of death is Adar II, the anniversary is the same day in the last month of the Hebrew year (Adar or Adar II).
- If the date of death is Adar I 30, the anniversary in a Hebrew year that is not a leap year (in which Adar only has 29 days) is the last day in Shevat.
- In all other cases, use the normal (that is, same month number) anniversary of the date of death. [Calendrical Calculations p. 113]
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'
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 |
HebrewCalendar.getHolidaysForYearArray(year, il) ⇒ 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 |
HebrewCalendar.getHolidaysOnDate(date, [il]) ⇒ 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 |
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 HebrewCalendar.Options
to determine
locale.
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 | Options |
Kind: static method of HebrewCalendar
HebrewCalendar.getSedra(hyear, il) ⇒ 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 |
Options to configure which events are returned
Kind: static typedef of HebrewCalendar
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 supressed. |
havdalahDeg | number |
degrees for solar depression for Havdalah. Default is 8.5 degrees for 3 small stars. use 7.083 degress for 3 medium-sized stars. If 0 , Havdalah times are supressed. |
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 |
dafyomi | boolean |
include Daf Yomi |
mishnaYomi | boolean |
include Mishna Yomi |
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 |
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) // 'א׳קכ״ג'
Kind: global typedef
Properties
Name | Type |
---|---|
dawn | Date |
dusk | Date |
goldenHour | Date |
goldenHourEnd | Date |
nauticalDawn | Date |
nauticalDusk | Date |
night | Date |
nightEnd | Date |
solarNoon | Date |
sunrise | Date |
sunriseEnd | Date |
sunset | Date |
sunsetStart | Date |
alotHaShachar | Date |
misheyakir | Date |
misheyakirMachmir | Date |
tzeit | Date |
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 |
Options to configure which events are returned
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
k | string |
tractate name in Sephardic transliteration (e.g. "Berakhot", "Moed Katan") |
v | string |
verse (e.g. "2:1") |