Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@hebcal/core
Advanced tools
Hebcal, a perpetual Jewish Calendar (ES6)
$ npm install @hebcal/core
import {hebcal, 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 = hebcal.hebrewCalendar(options);
for (const ev of events) {
const hd = ev.getDate();
const date = hd.greg();
console.log(date.toLocaleDateString(), ev.render(), hd.toString());
}
Represents an Event with a title, date, and flags
Class representing a Hebrew date
Daily Hebrew date ("11th of Sivan, 5780")
Class representing halachic times
Class representing Location
Havdalah after Shabbat or holiday
Candle lighting before Shabbat or holiday
Represents a Molad announcement on Shabbat Mevarchim
Represents a day 1-49 of counting the Omer from Pesach to Shavuot
For a Daf Yomi, the name is already translated attrs.dafyomi.name contains the untranslated string
Represents Parashah HaShavua for an entire Hebrew year
Represents one of 54 weekly Torah portions, always on a Saturday
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
Represents Rosh Chodesh, the beginning of a new month
Represents Mevarchim haChodesh, the announcement of the new month
object
Common hebrew date routines
object
Daf Yomi
object
Gregorian date routines
object
Lower-level holidays interface
object
Main interface to Hebcal
boolean
Returns true if Hebrew year is a leap year
number
Number of months in Hebrew year
number
Number of days in Hebrew month in a given year
string
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
number
Returns the Hebrew month number
number
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
number
Number of days in the hebrew YEAR
boolean
true if Cheshvan is long in Hebrew YEAR
boolean
true if Kislev is short in Hebrew YEAR
number
Converts Hebrew month string name to numeric
number
Note: Applying this function to d+6 gives us the DAYNAME on or after an absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to absolute date d, applying it to d-1 gives the DAYNAME previous to absolute date d, and applying it to d+7 gives the DAYNAME following absolute date d.
Array.<number>
Returns an array from start to end
boolean
Returns true if the Gregorian year is a leap year
number
Number of days in the Gregorian month for given year
number
Returns number of days since January 1 of that year
number
Converts Gregorian date to Julian Day Count
Date
Converts from Julian Day Count 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.
string
Returns translation only if locale
offers a translation for id
.
Otherwise, returns undefined.
string
By default, if no translation was found, returns id
.
Register locale translations.
Alias for addLocale()
LocaleData
Activates a locale. Throws an error if the locale has not been previously added. After setting the locale to be used, all strings marked for translations will be represented by the corresponding translation in the specified locale.
string
Removes nekudot from Hebrew string
HDate
number
Converts Hebrew date to absolute Julian days. The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.
SimpleHebrewDate
Converts absolute Julian days to Hebrew date
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]
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:
boolean
Adds a location name for Location.lookup()
only if the name isn't
already being used. Returns false
if the name is already taken
and true
if successfully added.
string
Array.<Object>
Array.<Object>
Event
Molad
Calculates the molad for a Hebrew month
DafYomiResult
Returns the Daf Yomi for given date
string
Formats (with translation) the dafyomi result as a string like "Pesachim 34"
number
parsha doubler/undoubler
Object
Returns an object describing the parsha on the first Saturday on or after absdate
string
Map.<string, Array.<Event>>
Returns a Map for the year indexed by HDate.toString()
Array.<Event>
Returns an array of Events on this date (or undefined if no events)
string
Returns "8:13p" for US or "20:13" for any other locale/country
string
number
number
Gets the Julian absolute days for a number, Date, or HDate
Array.<number>
Parse options object to determine start & end days
Array.<number>
number
Mask to filter Holiday array
Array.<Event>
Generates a list of holidays
Object
A simple Hebrew date object with numeric fields yy
, mm
, and dd
Object
Represents a Molad
Object
A Daf Yomi result
Object
Options to configure which events are returned
Represents an Event with a title, date, and flags
Kind: global class
number
Object
boolean
boolean
string
string
string
string
HDate
string
Constructs Event
Param | Type | Default | Description |
---|---|---|---|
date | HDate | Hebrew date event occurs | |
desc | string | Description (not translated) | |
[mask] | number | 0 | optional holiday flags |
[attrs] | Object | {} |
number
Kind: instance method of Event
Object
Kind: instance method of Event
boolean
Is this event observed in Israel?
Kind: instance method of Event
boolean
Is this event observed in the Diaspora?
Kind: instance method of Event
string
Returns (translated) description of this event
Kind: instance method of Event
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns a brief (translated) description of this event. For most events, this is the same as render(). For some events, it procudes a shorter text (e.g. without a time or added description).
Kind: instance method of Event
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns untranslated description of this event
Kind: instance method of Event
string
Returns a simplified (untranslated) description for this event. For example, "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
HDate
Returns Hebrew date of this event
Kind: instance method of Event
string
Kind: instance method of Event
Class representing a Hebrew date
Kind: global class
number
boolean
number
number
number
number
number
HDate
HDate
HDate
HDate
Date
number
string
string
HDate
HDate
HDate
HDate
HDate
HDate
HDate
boolean
string
Create a Hebrew date. There are 3 basic forms for the HDate()
constructor.
Date
- represents the Hebrew date corresponding to the Gregorian date using
local time. Hours, minutes, seconds and milliseconds are ignored.HDate
- clones a copy of the given Hebrew datenumber
- Converts absolute Julian days to Hebrew date. The absolute Julian
date is the number of days elapsed since the (imaginary) Gregorian date
Sunday, December 31, 1 BCParam | 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, common} 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, common.months.CHESHVAN, 5769);
const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
const monthName = 'אייר';
const hd6 = new HDate(5, monthName, 5773);
number
Gets the Hebrew year of this Hebrew date
Kind: instance method of HDate
boolean
Tests if this date occurs during a leap year
Kind: instance method of HDate
number
Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
Kind: instance method of HDate
number
Kind: instance method of HDate
number
Number of days in the month of this Hebrew date
Kind: instance method of HDate
number
Gets the day within the month (1-30)
Kind: instance method of HDate
number
Gets the day of the week, using local time.
Kind: instance method of HDate
HDate
Kind: instance method of HDate
Param | Type |
---|---|
year | number |
HDate
Kind: instance method of HDate
Param | Type |
---|---|
month | number |
HDate
Kind: instance method of HDate
Param | Type |
---|---|
month | number |
HDate
Kind: instance method of HDate
Param | Type |
---|---|
date | number |
Date
Converts to Gregorian date
Kind: instance method of HDate
number
Returns Julian absolute days
Kind: instance method of HDate
string
Returns a transliterated Hebrew month name, e.g. 'Elul'
or 'Cheshvan'
.
Kind: instance method of HDate
string
Returns translated/transliterated Hebrew date, e.g. '15 Cheshvan 5769'
.
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Example
import {HDate, common} from '@hebcal/core';
const hd = new HDate(15, common.months.CHESHVAN, 5769);
console.log(hd.render()); // '15 Cheshvan 5769'
console.log(hd.render('he')); // '15 חֶשְׁוָן 5769'
HDate
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
HDate
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
HDate
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
HDate
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
HDate
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
day | number | day of week |
HDate
Returns the next Hebrew date
Kind: instance method of HDate
HDate
Returns the previous Hebrew date
Kind: instance method of HDate
boolean
Compares this date to another date, returning true
if the dates match.
Kind: instance method of HDate
Param | Type | Description |
---|---|---|
other | HDate | Hebrew date to compare |
string
Kind: instance method of HDate
Daily Hebrew date ("11th of Sivan, 5780")
Kind: global class
string
Param | Type |
---|---|
date | HDate |
locale | string |
string
Kind: instance method of HebrewDateEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Example
import {HDate, HebrewDateEvent, common} from '@hebcal/core';
const hd = new HDate(15, common.months.CHESHVAN, 5769);
const ev = new HebrewDateEvent(hd);
console.log(ev.render()); // '15th of Cheshvan, 5769'
console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
string
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
suncalc.GetTimesResult
Date
Date
number
number
Date
number
number
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
Date
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 |
suncalc.GetTimesResult
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
number
Kind: instance method of Zmanim
number
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
number
Kind: instance method of Zmanim
number
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Param | Type |
---|---|
hours | number |
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Date
Kind: instance method of Zmanim
Class representing Location
Kind: global class
number
number
boolean
string
string
string
Date
Date
string
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 | number | optional numeric geographic ID |
number
Kind: instance method of Location
number
Kind: instance method of Location
boolean
Kind: instance method of Location
string
Kind: instance method of Location
string
Kind: instance method of Location
string
Kind: instance method of Location
Date
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
Date
Kind: instance method of Location
Param | Type |
---|---|
hdate | Date | HDate |
string
Kind: instance method of Location
Location
Creates a location object from one of 60 "classic" Hebcal city names. The following city names are supported: 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva', 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest', 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland', 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa', 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg', 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles', 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City', 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City', 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix', 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg', 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney', 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains', 'Washington DC', 'Worcester'
Kind: static method of Location
Param | Type |
---|---|
name | string |
Havdalah after Shabbat or holiday
Kind: global class
Param | Type |
---|---|
date | HDate |
mask | number |
attrs | Object |
[havdalahMins] | number |
string
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns translation of "Havdalah" without the time.
Kind: instance method of HavdalahEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Candle lighting before Shabbat or holiday
Kind: global class
Param | Type |
---|---|
date | HDate |
mask | number |
attrs | Object |
string
Kind: instance method of CandleLightingEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns translation of "Candle lighting" without the time.
Kind: instance method of CandleLightingEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Represents a Molad announcement on Shabbat Mevarchim
Kind: global class
Param | Type | Description |
---|---|---|
date | HDate | Hebrew date event occurs |
hyear | number | molad year |
hmonth | number | molad month |
string
Kind: instance method of MoladEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
Represents a day 1-49 of counting the Omer from Pesach to Shavuot
Kind: global class
string
string
Param | Type |
---|---|
date | HDate |
omerDay | number |
string
Kind: instance method of OmerEvent
Todo
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
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). |
For a Daf Yomi, the name is already translated attrs.dafyomi.name contains the untranslated string
Kind: global class
string
string
string
Param | Type |
---|---|
date | HDate |
daf | DafYomiResult |
string
Kind: instance method of DafYomiEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns daf yomi name the 'Daf Yomi: ' prefix.
Kind: instance method of DafYomiEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Kind: instance method of DafYomiEvent
Represents Parashah HaShavua for an entire Hebrew year
Kind: global class
Array.<string>
string
Object
boolean
Array.<Object>
number
Caculates the Parashah HaShavua for an entire Hebrew year
Param | Type | Description |
---|---|---|
hebYr | number | Hebrew year (e.g. 5749) |
il | boolean | Use Israel sedra schedule (false for Diaspora) |
Array.<string>
Returns the parsha (or parshiyot) read on Hebrew date
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or absolute days |
string
Looks up parsha for the date, then returns a (translated) string
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or absolute days |
Object
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 absolute days |
boolean
Checks to see if this day would be a regular parasha HaShavua Torah reading or special holiday reading
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hDate | HDate | number | Hebrew date or absolute days |
Array.<Object>
Kind: instance method of Sedra
number
Kind: instance method of Sedra
Represents one of 54 weekly Torah portions, always on a Saturday
Kind: global class
string
string
string
Param | Type | Description |
---|---|---|
date | HDate | |
parsha | Array.<string> | untranslated name of single or double parsha, such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim'] |
string
Kind: instance method of ParshaEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
Kind: instance method of ParshaEvent
string
Kind: instance method of ParshaEvent
Represents a built-in holiday like Pesach, Purim or Tu BiShvat
Kind: global class
string
string
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 | {} |
string
Kind: instance method of HolidayEvent
string
Kind: instance method of HolidayEvent
Param | Type |
---|---|
locale | string |
string
Kind: instance method of HolidayEvent
Represents Rosh Chodesh, the beginning of a new month
Kind: global class
string
string
Constructs Rosh Chodesh event
Param | Type | Description |
---|---|---|
date | HDate | Hebrew date event occurs |
monthName | string | Hebrew month name (not translated) |
string
Returns (translated) description of this event
Kind: instance method of RoshChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Kind: instance method of RoshChodeshEvent
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) |
string
Returns (translated) description of this event
Kind: instance method of MevarchimChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
string
Returns (translated) description of this event
Kind: instance method of MevarchimChodeshEvent
Param | Type | Description |
---|---|---|
[locale] | string | Optional locale name (defaults to active locale). |
object
Common hebrew date routines
object
Daf Yomi
object
Gregorian date routines
object
Lower-level holidays interface
object
Main interface to Hebcal
enum
Hebrew months of the year (NISAN=1, TISHREI=7)
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
NISAN | number | 1 | Nissan / ניסן |
IYYAR | number | 2 | Iyyar / אייר |
SIVAN | number | 3 | Sivan / סיון |
TAMUZ | number | 4 | Tamuz (sometimes Tammuz) / תמוז |
AV | number | 5 | Av / אב |
ELUL | number | 6 | Elul / אלול |
TISHREI | number | 7 | Tishrei / תִשְׁרֵי |
CHESHVAN | number | 8 | Cheshvan / חשון |
KISLEV | number | 9 | Kislev / כסלו |
TEVET | number | 10 | Tevet / טבת |
SHVAT | number | 11 | Sh'vat / שבט |
ADAR_I | number | 12 | Adar or Adar Rishon / אדר |
ADAR_II | number | 13 | Adar Sheini (only on leap years) / אדר ב׳ |
enum
Days of the week (SUN=0, SAT=6)
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
SUN | number | 0 | Sunday |
MON | number | 1 | Monday |
TUE | number | 2 | Tuesday |
WED | number | 3 | Wednesday |
THU | number | 4 | Thursday |
FRI | number | 5 | Friday |
SAT | number | 6 | Saturday |
enum
Holiday flags for Event
Kind: global enum
Read only: true
Properties
Name | Type | Default | Description |
---|---|---|---|
CHAG | number | CHAG | Chag, yontiff, yom tov |
LIGHT_CANDLES | number | LIGHT_CANDLES | Light candles 18 minutes before sundown |
YOM_TOV_ENDS | number | YOM_TOV_ENDS | End of holiday (end of Yom Tov) |
CHUL_ONLY | number | CHUL_ONLY | Observed only in the Diaspora (chutz l'aretz) |
IL_ONLY | number | IL_ONLY | Observed only in Israel |
LIGHT_CANDLES_TZEIS | number | LIGHT_CANDLES_TZEIS | Light candles in the evening at Tzeit time (3 small stars) |
CHANUKAH_CANDLES | number | CHANUKAH_CANDLES | Candle-lighting for Chanukah |
ROSH_CHODESH | number | ROSH_CHODESH | Rosh Chodesh, beginning of a new Hebrew month |
MINOR_FAST | number | MINOR_FAST | Minor fasts like Tzom Tammuz, Ta'anit Esther, ... |
SPECIAL_SHABBAT | number | SPECIAL_SHABBAT | Shabbat Shekalim, Zachor, ... |
PARSHA_HASHAVUA | number | PARSHA_HASHAVUA | Weekly sedrot on Saturdays |
DAF_YOMI | number | DAF_YOMI | Daily page of Talmud |
OMER_COUNT | number | OMER_COUNT | Days of the Omer |
MODERN_HOLIDAY | number | MODERN_HOLIDAY | Yom HaShoah, Yom HaAtzma'ut, ... |
MAJOR_FAST | number | MAJOR_FAST | Yom Kippur and Tish'a B'Av |
SHABBAT_MEVARCHIM | number | SHABBAT_MEVARCHIM | 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") |
boolean
Returns true if Hebrew year is a leap year
Kind: global function
Param | Type | Description |
---|---|---|
x | number | Hebrew year |
number
Number of months in Hebrew year
Kind: global function
Param | Type | Description |
---|---|---|
x | number | Hebrew year |
number
Number of days in Hebrew month in a given year
Kind: global function
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
string
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
Kind: global function
Param | Type | Description |
---|---|---|
month | number | Hebrew month (e.g. months.TISHREI) |
year | number | Hebrew year |
number
Returns the Hebrew month number
Kind: global function
Param | Type | Description |
---|---|---|
month | number | string | A number, or Hebrew month name string |
number
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
hYear | number | Hebrew year |
number
Number of days in the hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Cheshvan is long in Hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
boolean
true if Kislev is short in Hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Converts Hebrew month string name to numeric
Kind: global function
Param | Type | Description |
---|---|---|
c | string | monthName |
number
Note: Applying this function to d+6 gives us the DAYNAME on or after an absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to absolute date d, applying it to d-1 gives the DAYNAME previous to absolute date d, and applying it to d+7 gives the DAYNAME following absolute date d.
Kind: global function
Param | Type |
---|---|
day_of_week | number |
absdate | number |
Array.<number>
Returns an array from start to end
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
start | number | beginning number, inclusive | |
end | number | ending number, inclusive | |
[step] | number | 1 |
boolean
Returns true if the Gregorian year is a leap year
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Gregorian year |
number
Number of days in the Gregorian month for given year
Kind: global function
Param | Type | Description |
---|---|---|
month | number | Gregorian month (1=January, 12=December) |
year | number | Gregorian year |
number
Returns number of days since January 1 of that year
Kind: global function
Param | Type | Description |
---|---|---|
date | Date | Gregorian date |
number
Converts Gregorian date to Julian Day Count
Kind: global function
Param | Type | Description |
---|---|---|
date | Date | Gregorian date |
Date
Converts from Julian Day Count 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: global function
Param | Type | Description |
---|---|---|
theDate | number | absolute Julian days |
string
Returns translation only if locale
offers a translation for id
.
Otherwise, returns undefined.
Kind: global function
Param | Type | Description |
---|---|---|
id | string | Message ID to translate |
[locale] | string | Optional locale name (i.e: 'he' , 'fr' ). Defaults to active locale. |
string
By default, if no translation was found, returns id
.
Kind: global function
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: global function
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e.: 'he' , 'fr' ) |
data | LocaleDate | parsed data from a .po file. |
Alias for addLocale()
Kind: global function
Param | Type |
---|---|
locale | string |
data | any |
LocaleData
Activates a locale. Throws an error if the locale has not been previously added. After setting the locale to be used, all strings marked for translations will be represented by the corresponding translation in the specified locale.
Kind: global function
Param | Type | Description |
---|---|---|
locale | string | Locale name (i.e: 'he' , 'fr' ) |
string
Removes nekudot from Hebrew string
Kind: global function
Param | Type |
---|---|
str | string |
HDate
Kind: global function
Param | Type |
---|---|
day | number |
t | HDate |
offset | number |
number
Converts Hebrew date to absolute Julian days. The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.
Kind: global function
Param | Type | Description |
---|---|---|
d | HDate | SimpleHebrewDate | Hebrew Date |
SimpleHebrewDate
Converts absolute Julian days to Hebrew date
Kind: global function
Param | Type | Description |
---|---|---|
d | number | absolute Julian days |
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: global function
Returns: HDate
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
gdate | Date | HDate | Gregorian or Hebrew date of event |
Example
import {hebcal} from '@hebcal/core';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const hd = hebcal.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
HDate
Calculates yahrzeit.
hyear
must be after original gdate
of death.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The customary anniversary date of a death is more complicated and depends also on the character of the year in which the first anniversary occurs. There are several cases:
Kind: global function
Returns: HDate
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number | Hebrew year |
gdate | Date | HDate | Gregorian or Hebrew date of death |
Example
import {hebcal} from '@hebcal/core';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const hd = hebcal.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
Kind: global function
Param | Type |
---|---|
error | string |
boolean
Adds a location name for Location.lookup()
only if the name isn't
already being used. Returns false
if the name is already taken
and true
if successfully added.
Kind: global function
Param | Type |
---|---|
cityName | string |
location | Location |
string
Kind: global function
Param | Type |
---|---|
timeFormat | Intl.DateTimeFormat |
dt | Date |
Array.<Object>
Kind: global function
Param | Type |
---|---|
hd | HDate |
location | Location |
timeFormat | Intl.DateTimeFormat |
offset | number |
Array.<Object>
Kind: global function
Param | Type |
---|---|
hd | HDate |
location | Location |
timeFormat | Intl.DateTimeFormat |
Event
Kind: global function
Param | Type |
---|---|
e | Event |
hd | HDate |
dow | number |
location | Location |
timeFormat | Intl.DateTimeFormat |
candlesOffset | number |
[havdalahOffset] | number |
Molad
Calculates the molad for a Hebrew month
Kind: global function
Param | Type |
---|---|
year | number |
month | number |
DafYomiResult
Returns the Daf Yomi for given date
Kind: global function
Returns: DafYomiResult
- Tractact name and page number
Param | Type | Description |
---|---|---|
gregdate | Date | Gregorian date |
string
Formats (with translation) the dafyomi result as a string like "Pesachim 34"
Kind: global function
Param | Type | Description |
---|---|---|
daf | DafYomiResult | the Daf Yomi |
[locale] | string | Optional locale name (defaults to active locale). |
number
parsha doubler/undoubler
Kind: global function
Param | Type |
---|---|
p | number |
Object
Returns an object describing the parsha on the first Saturday on or after absdate
Kind: global function
Param | Type |
---|---|
year | number |
absDate | number |
string
Kind: global function
Param | Type |
---|---|
day | number |
Map.<string, Array.<Event>>
Returns a Map for the year indexed by HDate.toString()
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
Kind: inner method of getHolidaysForYear
Param | Type |
---|---|
year | number |
arr | Array.<Object> |
Array.<Event>
Returns an array of Events on this date (or undefined if no events)
Kind: global function
Param | Type | Description |
---|---|---|
date | HDate | Date | number | Hebrew Date, Gregorian date, or absolute Julian date |
string
Returns "8:13p" for US or "20:13" for any other locale/country
Kind: global function
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 | Object |
string
Kind: global function
Param | Type |
---|---|
s | string |
number
Kind: global function
Param | Type |
---|---|
options | HebcalOptions |
number
Gets the Julian absolute days for a number, Date, or HDate
Kind: global function
Param | Type |
---|---|
d | Date | HDate | number |
Array.<number>
Parse options object to determine start & end days
Kind: global function
Param | Type |
---|---|
options | HebcalOptions |
Array.<number>
Kind: global function
Param | Type |
---|---|
hyear | number |
number
Mask to filter Holiday array
Kind: global function
Param | Type |
---|---|
options | HebcalOptions |
Array.<Event>
Generates a list of holidays
Kind: global function
Param | Type |
---|---|
options | HebcalOptions |
Object
A simple Hebrew date object with numeric fields yy
, mm
, and dd
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
yy | number | Hebrew year |
mm | number | Hebrew month of year (1=NISAN, 7=TISHREI) |
dd | number | Day of month (1-30) |
Object
Represents a Molad
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
dow | number | Day of Week (0=Sunday, 6=Saturday) |
hour | number | hour of day (0-23) |
minutes | number | minutes past hour (0-59) |
chalakim | number | parts of a minute (0-17) |
Object
A Daf Yomi result
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | string | Tractate name |
blatt | number | Page number |
Object
Options to configure which events are returned
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
location | Location | latitude/longitude/tzid used for candle-lighting |
year | number | Gregorian or Hebrew year |
isHebrewYear | boolean | to interpret year as Hebrew year |
month | number | Gregorian or Hebrew month (to filter results to a single month) |
numYears | number | generate calendar for multiple years (default 1) |
start | Date | HDate | number | use specific start date (requires end date) |
end | Date | HDate | number | use specific end date (requires start date) |
candlelighting | boolean | calculate candle-lighting and havdalah times |
candleLightingMins | number | minutes before sundown to light candles (default 18) |
havdalahMins | number | minutes after sundown for Havdalah (typical values are 42, 50, or 72) |
havdalahTzeit | boolean | calculate Havdalah according to Tzeit Hakochavim - Nightfall (the point when 3 small stars are observable in the night time sky with the naked eye). Defaults to true unless havdalahMins is specified |
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 |
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 (one of fi , fr , he , hu , pl , ru , ashkenazi , ashkenazi_litvish , ashkenazi_poylish , ashkenazi_standard ) |
hour12 | boolean | use 12-hour time (1-12) instead of default 24-hour time (0-23) |
addHebrewDates | boolean | print the Hebrew date for the entire date range |
addHebrewDatesForEvents | boolean | print the Hebrew date for dates with some events |
FAQs
A perpetual Jewish Calendar API
The npm package @hebcal/core receives a total of 2,612 weekly downloads. As such, @hebcal/core popularity was classified as popular.
We found that @hebcal/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.