README
@hebcal/core
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.
Installation
$ npm install @hebcal/core
Synopsis
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());
}
Classes
- 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
Objects
- 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. "שבת")
Constants
- 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.
Functions
- 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 [ה]).
Typedefs
- ZmanimTimesResult :
Object
- SedraResult :
Object
Result of Sedra.lookup
- MishnaYomi :
Object
Options to configure which events are returned
HDate
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) ⇒
new HDate([day], [month], [year])
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);
number
hDate.getFullYear() ⇒ Gets the Hebrew year of this Hebrew date
Kind: instance method of HDate
boolean
hDate.isLeapYear() ⇒ Tests if this date occurs during a leap year
Kind: instance method of HDate
number
hDate.getMonth() ⇒ Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
Kind: instance method of HDate
number
hDate.getTishreiMonth() ⇒ 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
hDate.daysInMonth() ⇒ Number of days in the month of this Hebrew date
Kind: instance method of HDate
number
hDate.getDate() ⇒ Gets the day within the month (1-30)
Kind: instance method of HDate
number
hDate.getDay() ⇒ Gets the day of the week. 0=Sunday, 6=Saturday
Kind: instance method of HDate
Date
hDate.greg() ⇒ Converts to Gregorian date
Kind: instance method of HDate
number
hDate.abs() ⇒ 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
hDate.getMonthName() ⇒ Returns a transliterated Hebrew month name, e.g. 'Elul'
or 'Cheshvan'
.
Kind: instance method of HDate
string
hDate.render([locale], [showYear]) ⇒ 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'
string
hDate.renderGematriya() ⇒ 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
hDate.before(day) ⇒ 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
hDate.onOrBefore(dow) ⇒ 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
hDate.nearest(dow) ⇒ 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
hDate.onOrAfter(dow) ⇒ 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
hDate.after(day) ⇒ 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
hDate.next() ⇒ Returns the next Hebrew date
Kind: instance method of HDate
HDate
hDate.prev() ⇒ Returns the previous Hebrew date
Kind: instance method of HDate
HDate
hDate.add(number, [units]) ⇒ 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
hDate.subtract(number, [units]) ⇒ 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
hDate.deltaDays(other) ⇒ 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
hDate.isSameDate(other) ⇒ 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
hDate.toString() ⇒ Kind: instance method of HDate
number
HDate.hebrew2abs(year, month, day) ⇒ 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
HDate.isLeapYear(year) ⇒ Returns true if Hebrew year is a leap year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
number
HDate.monthsInYear(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
HDate.daysInMonth(month, 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 |
string
HDate.getMonthName(month, 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 |
number
HDate.monthNum(month) ⇒ 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
HDate.elapsedDays(year) ⇒ 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
HDate.daysInYear(year) ⇒ Number of days in the hebrew YEAR
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
boolean
HDate.longCheshvan(year) ⇒ true if Cheshvan is long in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
boolean
HDate.shortKislev(year) ⇒ true if Kislev is short in Hebrew year
Kind: static method of HDate
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
number
HDate.monthFromName(monthName) ⇒ Converts Hebrew month string name to numeric
Kind: static method of HDate
Param | Type | Description |
---|---|---|
monthName | string |
monthName |
number
HDate.dayOnOrBefore(dayOfWeek, absdate) ⇒ 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
HDate.isHDate(obj) ⇒ Tests if the object is an instance of HDate
Kind: static method of HDate
Param | Type |
---|---|
obj | any |
Event
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
new Event(date, desc, [mask], [attrs])
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
event.getDate() ⇒ Hebrew date of this event
Kind: instance method of Event
string
event.getDesc() ⇒ Untranslated description of this event
Kind: instance method of Event
number
event.getFlags() ⇒ Bitmask of optional event flags. See flags
Kind: instance method of Event
string
event.render([locale]) ⇒ 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'
string
event.renderBrief([locale]) ⇒ 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
event.getEmoji() ⇒ Optional holiday-specific Emoji or null
.
Kind: instance method of Event
string
event.basename() ⇒ 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
event.url() ⇒ 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
event.observedInIsrael() ⇒ 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
event.observedInDiaspora() ⇒ 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
Object
event.getAttrs() ⇒
Object
Deprecated
Kind: instance method of Event
Event
event.clone() ⇒ Makes a clone of this Event object
Kind: instance method of Event
HebrewDateEvent
Daily Hebrew date ("11th of Sivan, 5780")
Kind: global class
- HebrewDateEvent
- new HebrewDateEvent(date)
- instance
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .render([locale]) ⇒
- static
new HebrewDateEvent(date)
Param | Type |
---|---|
date | HDate |
string
hebrewDateEvent.render([locale]) ⇒ 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')); // 'ט״ו חֶשְׁוָן תשס״ט'
string
hebrewDateEvent.renderBrief([locale]) ⇒ 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')); // 'ט״ו חֶשְׁוָן'
string
HebrewDateEvent.renderHebrew(day, monthName, fullYear) ⇒
string
Deprecated
Helper function to render a Hebrew date
Kind: static method of HebrewDateEvent
Param | Type |
---|---|
day | number |
monthName | string |
fullYear | number |
Zmanim
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) ⇒
new Zmanim(date, latitude, longitude)
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 |
ZmanimTimesResult
zmanim.suntime() ⇒
ZmanimTimesResult
Deprecated
Kind: instance method of Zmanim
Date
zmanim.sunrise() ⇒ Kind: instance method of Zmanim
Date
zmanim.sunset() ⇒ Kind: instance method of Zmanim
Date
zmanim.dawn() ⇒ Kind: instance method of Zmanim
Date
zmanim.dusk() ⇒ Kind: instance method of Zmanim
number
zmanim.hour() ⇒ Kind: instance method of Zmanim
number
zmanim.hourMins() ⇒ Kind: instance method of Zmanim
Date
zmanim.gregEve() ⇒ Kind: instance method of Zmanim
number
zmanim.nightHour() ⇒ Kind: instance method of Zmanim
number
zmanim.nightHourMins() ⇒ Kind: instance method of Zmanim
Date
zmanim.hourOffset(hours) ⇒ Kind: instance method of Zmanim
Param | Type |
---|---|
hours | number |
Date
zmanim.chatzot() ⇒ Kind: instance method of Zmanim
Date
zmanim.chatzotNight() ⇒ Kind: instance method of Zmanim
Date
zmanim.alotHaShachar() ⇒ Kind: instance method of Zmanim
Date
zmanim.misheyakir() ⇒ Kind: instance method of Zmanim
Date
zmanim.misheyakirMachmir() ⇒ Kind: instance method of Zmanim
Date
zmanim.sofZmanShma() ⇒ Kind: instance method of Zmanim
Date
zmanim.sofZmanTfilla() ⇒ Kind: instance method of Zmanim
Date
zmanim.minchaGedola() ⇒ Kind: instance method of Zmanim
Date
zmanim.minchaKetana() ⇒ Kind: instance method of Zmanim
Date
zmanim.plagHaMincha() ⇒ Kind: instance method of Zmanim
Date
zmanim.tzeit([angle]) ⇒ 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. |
Date
zmanim.neitzHaChama() ⇒ Kind: instance method of Zmanim
Date
zmanim.shkiah() ⇒ Kind: instance method of Zmanim
Date
zmanim.sunsetOffset(offset) ⇒ Returns sunset + offset (either positive or negative).
Kind: instance method of Zmanim
Param | Type |
---|---|
offset | number |
Array.<Object>
zmanim.sunsetOffsetTime(offset, timeFormat) ⇒
Array.<Object>
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 |
Array.<Object>
zmanim.tzeitTime(angle, timeFormat) ⇒
Array.<Object>
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 |
string
Zmanim.formatTime(dt, timeFormat) ⇒ Uses timeFormat to return a date like '20:34'
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
timeFormat | Intl.DateTimeFormat |
Date
Zmanim.roundTime(dt) ⇒ Discards seconds, rounding to nearest minute.
Kind: static method of Zmanim
Param | Type |
---|---|
dt | Date |
string
Zmanim.timeZoneOffset(tzid, 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 |
string
Zmanim.formatISOWithTimeZone(tzid, date) ⇒ Returns a string like "2022-04-01T13:06:00-11:00"
Kind: static method of Zmanim
Param | Type |
---|---|
tzid | string |
date | Date |
Location
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) ⇒
new Location(latitude, longitude, il, tzid, cityName, countryCode, geoid)
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 |
number
location.getLatitude() ⇒ Kind: instance method of Location
number
location.getLongitude() ⇒ Kind: instance method of Location
boolean
location.getIsrael() ⇒ Kind: instance method of Location
string
location.getName() ⇒ Kind: instance method of Location
string
location.getShortName() ⇒ Returns the location name, up to the first comma
Kind: instance method of Location
string
location.getCountryCode() ⇒ Kind: instance method of Location
string
location.getTzid() ⇒ Kind: instance method of Location
Intl.DateTimeFormat
location.getTimeFormatter() ⇒ Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
Kind: instance method of Location
string
location.getGeoId() ⇒ Kind: instance method of Location
Date
location.sunset(hdate) ⇒
Date
Deprecated
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
Date
location.tzeit(hdate, [angle]) ⇒
Date
Deprecated
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
[angle] | number |
string
location.toString() ⇒ Kind: instance method of Location
Location
Location.lookup(name) ⇒ 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
Location.legacyTzToTzid(tz, dst) ⇒ 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
Location.getUsaTzid(state, tz, dst) ⇒ 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'
string
Location.geonameCityDescr(cityName, admin1, countryName) ⇒ 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' |
boolean
Location.addLocation(cityName, location) ⇒ 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 |
TimedEvent
An event that has an eventTime
and eventTimeStr
Kind: global class
new TimedEvent(date, desc, mask, eventTime, location, linkedEvent)
Param | Type | Description |
---|---|---|
date | HDate |
|
desc | string |
Description (not translated) |
mask | number |
|
eventTime | Date |
|
location | Location |
|
linkedEvent | Event |
string
timedEvent.render([locale]) ⇒ Kind: instance method of TimedEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
string
timedEvent.renderBrief([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). |
HavdalahEvent
Havdalah after Shabbat or holiday
Kind: global class
new HavdalahEvent(date, mask, eventTime, location, havdalahMins, linkedEvent)
Param | Type |
---|---|
date | HDate |
mask | number |
eventTime | Date |
location | Location |
havdalahMins | number |
linkedEvent | Event |
string
havdalahEvent.render([locale]) ⇒ Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
string
havdalahEvent.renderBrief([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). |
string
havdalahEvent.getEmoji() ⇒ Kind: instance method of HavdalahEvent
CandleLightingEvent
Candle lighting before Shabbat or holiday
Kind: global class
new CandleLightingEvent(date, mask, eventTime, location, linkedEvent)
Param | Type |
---|---|
date | HDate |
mask | number |
eventTime | Date |
location | Location |
linkedEvent | Event |
string
candleLightingEvent.getEmoji() ⇒ Kind: instance method of CandleLightingEvent
Molad
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
new Molad(year, month)
Calculates the molad for a Hebrew month
Param | Type |
---|---|
year | number |
month | number |
number
molad.getYear() ⇒ Kind: instance method of Molad
number
molad.getMonth() ⇒ Kind: instance method of Molad
string
molad.getMonthName() ⇒ Kind: instance method of Molad
number
molad.getDow() ⇒ Kind: instance method of Molad
Returns: number
- Day of Week (0=Sunday, 6=Saturday)
number
molad.getHour() ⇒ Kind: instance method of Molad
Returns: number
- hour of day (0-23)
number
molad.getMinutes() ⇒ Kind: instance method of Molad
Returns: number
- minutes past hour (0-59)
number
molad.getChalakim() ⇒ Kind: instance method of Molad
Returns: number
- parts of a minute (0-17)
MoladEvent
Represents a Molad announcement on Shabbat Mevarchim
Kind: global class
new MoladEvent(date, hyear, hmonth)
Param | Type | Description |
---|---|---|
date | HDate |
Hebrew date event occurs |
hyear | number |
molad year |
hmonth | number |
molad month |
string
moladEvent.render([locale]) ⇒ Kind: instance method of MoladEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
OmerEvent
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
new OmerEvent(date, omerDay)
Param | Type |
---|---|
date | HDate |
omerDay | number |
string
omerEvent.render([locale]) ⇒ Kind: instance method of OmerEvent
Todo
- use gettext()
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (defaults to active locale). |
string
omerEvent.renderBrief([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). |
string
omerEvent.getEmoji() ⇒ Kind: instance method of OmerEvent
number
omerEvent.getWeeks() ⇒ Kind: instance method of OmerEvent
number
omerEvent.getDaysWithinWeeks() ⇒ Kind: instance method of OmerEvent
string
omerEvent.getTodayIs(locale) ⇒ Kind: instance method of OmerEvent
Param | Type |
---|---|
locale | string |
DafYomi
Returns the Daf Yomi for given date
Kind: global class
- DafYomi
- new DafYomi(gregdate)
- .getBlatt() ⇒
number
- .getName() ⇒
string
- .render([locale]) ⇒
string
new DafYomi(gregdate)
Initializes a daf yomi instance
Param | Type | Description |
---|---|---|
gregdate | Date | HDate | number |
Gregorian date |
number
dafYomi.getBlatt() ⇒ Kind: instance method of DafYomi
string
dafYomi.getName() ⇒ Kind: instance method of DafYomi
string
dafYomi.render([locale]) ⇒ 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). |
DafYomiEvent
Event wrapper around a DafYomi instance
Kind: global class
- DafYomiEvent
- new DafYomiEvent(date)
- .render([locale]) ⇒
string
- .renderBrief([locale]) ⇒
string
- .url() ⇒
string
new DafYomiEvent(date)
Param | Type |
---|---|
date | HDate |
string
dafYomiEvent.render([locale]) ⇒ 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). |
string
dafYomiEvent.renderBrief([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). |
string
dafYomiEvent.url() ⇒ Returns a link to sefaria.org or dafyomi.org
Kind: instance method of DafYomiEvent
Sedra
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
new Sedra(hebYr, il)
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>
sedra.get(hDate) ⇒ 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
sedra.getString(hDate, [locale]) ⇒ 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
sedra.isParsha(hDate) ⇒ 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
sedra.find(parsha) ⇒ Returns the date that a parsha occurs
Kind: instance method of Sedra
Param | Type |
---|---|
parsha | number | string | Array.<string> |
number
sedra.getFirstSaturday() ⇒ R.D. date of the first Saturday on or after Rosh Hashana
Kind: instance method of Sedra
number
sedra.getYear() ⇒ Kind: instance method of Sedra
SedraResult
sedra.lookup(hDate) ⇒ 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 |
ParshaEvent
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
new ParshaEvent(date, parsha, il)
Param | Type | Description |
---|---|---|
date | HDate |
|
parsha | Array.<string> |
untranslated name of single or double parsha, such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim'] |
il | boolean |
string
parshaEvent.render([locale]) ⇒ Kind: instance method of ParshaEvent
Param | Type | Description |
---|---|---|
[locale] | string |
Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
parshaEvent.basename() ⇒ Kind: instance method of ParshaEvent
string
parshaEvent.url() ⇒ Kind: instance method of ParshaEvent
string
parshaEvent.urlDateSuffix() ⇒ Kind: instance method of ParshaEvent
HolidayEvent
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()