converts between Hebrew and Gregorian dates using Rata Die (R.D.) algorithm by Dershowitz and Reingold
$ npm install @hebcal/hdate
import {greg, abs2hebrew} from '@hebcal/hdate';
const date = new Date(2008, 10, 13); // 13 November 2008
const abs = greg.greg2abs(date);
const hdate = abs2hebrew(abs); // {yy: 5769, mm: CHESHVAN, dd: 15}
- HDate
-
Represents a Hebrew date
- Locale
-
A locale in Hebcal is used for translations/transliterations of holidays.
@hebcal/hdate
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. "שבת")
-
- Sedra
-
Represents Parashah HaShavua for an entire Hebrew year
- greg
-
Gregorian date helper functions.
-
parshiot :
Array.<string>
-
The 54 parshiyot of the Torah as transilterated strings parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[52] == "Ha'azinu".
-
getYahrzeit(hyear, date) ⇒
Date
-
Calculates yahrzeit.
hyear
must be after originaldate
of death. Returnsundefined
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]
-
getBirthdayOrAnniversary(hyear, date) ⇒
Date
-
Calculates a birthday or anniversary (non-yahrzeit).
hyear
must be after originaldate
of anniversary. Returnsundefined
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]
-
getPseudoISO(tzid, date) ⇒
string
-
Returns a string similar to
Date.toISOString()
but in the timezonetzid
. Contrary to the typical meaning ofZ
at the end of the string, this is not actually a UTC date. -
getTimezoneOffset(tzid, date) ⇒
number
-
Returns number of minutes
tzid
is offset from UTC on datedate
. -
pad4(number) ⇒
string
-
Formats a number with leading zeros so the resulting string is 4 digits long. Similar to
string.padStart(4, '0')
but will also format negative numbers similar to how the JavaScript date formats negative year numbers (e.g.-37
is formatted as-000037
). -
pad2(number) ⇒
string
-
Formats a number with leading zeros so the resulting string is 2 digits long. Similar to
string.padStart(2, '0')
. -
gematriya(num) ⇒
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 [ה]).
-
gematriyaStrToNum(str) ⇒
number
-
Converts a string of Hebrew letters to a numerical value.
Only considers the value of Hebrew letters
א
throughת
. Ignores final Hebrew letters such asך
(kaf sofit) orם
(mem sofit) and vowels (nekudot). -
hebrew2abs(year, month, day) ⇒
number
-
Converts Hebrew date to R.D. (Rata Die) fixed days. R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian Calendar.
- hd2abs()
-
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.
-
abs2hebrew(abs) ⇒
SimpleHebrewDate
-
Converts absolute R.D. days to Hebrew date
-
isLeapYear(year) ⇒
boolean
-
Returns true if Hebrew year is a leap year
-
monthsInYear(year) ⇒
number
-
Number of months in this Hebrew year (either 12 or 13 depending on leap year)
-
daysInMonth(month, year) ⇒
number
-
Number of days in Hebrew month in a given year (29 or 30)
- getMonthName(month, year)
-
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
-
elapsedDays(year) ⇒
number
-
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
-
daysInYear(year) ⇒
number
-
Number of days in the hebrew YEAR. A common Hebrew calendar year can have a length of 353, 354 or 355 days A leap Hebrew calendar year can have a length of 383, 384 or 385 days
-
longCheshvan(year) ⇒
boolean
-
true if Cheshvan is long in Hebrew year
-
shortKislev(year) ⇒
boolean
-
true if Kislev is short in Hebrew year
-
monthFromName(monthName) ⇒
number
-
Converts Hebrew month string name to numeric
- molad()
-
Calculates the molad for a Hebrew month
- omerSefira(omerDay, lang) ⇒
-
Returns the sefira. For example, on day 8 חֶֽסֶד שֶׁבִּגְבוּרָה Chesed shebiGevurah Lovingkindness within Might
- omerTodayIs(omerDay, lang) ⇒
-
Returns a sentence with that evening's omer count
- omerEmoji(omerDay) ⇒
-
Returns an emoji number symbol with a circle, for example
㊲
from the “Enclosed CJK Letters and Months” block of the Unicode standard
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([suppressNikud]) ⇒
string
-
.before(dow) ⇒
HDate
-
.onOrBefore(dow) ⇒
HDate
-
.nearest(dow) ⇒
HDate
-
.onOrAfter(dow) ⇒
HDate
-
.after(dow) ⇒
HDate
-
.next() ⇒
HDate
-
.prev() ⇒
HDate
-
.add(amount, [units]) ⇒
HDate
-
.subtract(amount, [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
-
.daysInYear(year) ⇒
number
-
.longCheshvan(year) ⇒
boolean
-
.shortKislev(year) ⇒
boolean
-
.monthFromName(monthName) ⇒
number
-
.dayOnOrBefore(dayOfWeek, absdate) ⇒
number
-
.isHDate(obj) ⇒
boolean
-
.fromGematriyaString(str, currentThousands) ⇒
HDate
-
.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 date -
number
- 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/hdate';
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 |
Optional locale name (defaults to active locale). | |
[showYear] | boolean |
true |
Display year (defaults to true). |
Example
import {HDate, months} from '@hebcal/hdate';
const hd = new HDate(15, months.CHESHVAN, 5769);
console.log(hd.render('en')); // '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
Param | Type | Default |
---|---|---|
[suppressNikud] | boolean |
false |
Example
import {HDate, months} from '@hebcal/hdate';
const hd = new HDate(15, months.CHESHVAN, 5769);
console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
hDate.before(dow) ⇒ HDate
Returns an HDate
representing the a dayNumber 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')).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(dow) ⇒ HDate
Returns an HDate
representing the a dayNumber 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')).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(amount, [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 |
---|---|---|
amount | number |
|
[units] | string |
"d" |
hDate.subtract(amount, [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 |
---|---|---|
amount | number |
|
[units] | string |
"d" |
Example
import {HDate, months} from '@hebcal/hdate';
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/hdate';
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 |
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 | number
|
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 |
HDate.fromGematriyaString(str, currentThousands) ⇒ HDate
Construct a new instance of HDate
from a Gematriya-formatted string
Kind: static method of HDate
Param | Type | Default |
---|---|---|
str | string |
|
currentThousands | number |
5000 |
Example
HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
A locale in Hebcal is used for translations/transliterations of
holidays. @hebcal/hdate
supports four locales by default
-
en
- default, Sephardic transliterations (e.g. "Shabbat") -
ashkenazi
- Ashkenazi transliterations (e.g. "Shabbos") -
he
- Hebrew (e.g. "שַׁבָּת") -
he-x-NoNikud
- Hebrew without nikud (e.g. "שבת")
Kind: global class
-
Locale
-
.lookupTranslation(id, [locale]) ⇒
string
-
.gettext(id, [locale]) ⇒
string
- .addLocale(locale, data)
- .addTranslation(locale, id, translation)
- .addTranslations(locale, data)
- .useLocale(locale)
-
.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 | LocaleData |
parsed data from a .po file. |
Adds a translation to locale
, replacing any previous translation.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string |
Locale name (i.e: 'he' , 'fr' ). |
id | string |
Message ID to translate |
translation | string |
Translation text |
Adds multiple translations to locale
, replacing any previous translations.
Kind: static method of Locale
Param | Type | Description |
---|---|---|
locale | string |
Locale name (i.e: 'he' , 'fr' ). |
data | LocaleData |
parsed data from a .po file. |
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 |
Represents Parashah HaShavua for an entire Hebrew year
Kind: global class
-
Sedra
- new Sedra(hyear, il)
-
.get(hd) ⇒
Array.<string>
-
.getString(hd, [locale]) ⇒
string
-
.isParsha(hd) ⇒
boolean
-
.find(parsha) ⇒
HDate
|null
-
.getSedraArray() ⇒
Array.<NumberOrString>
-
.getFirstSaturday() ⇒
number
-
.getYear() ⇒
number
-
.lookup(hd) ⇒
SedraResult
Caculates the Parashah HaShavua for an entire Hebrew year
Param | Type | Description |
---|---|---|
hyear | 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 |
---|---|---|
hd |
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 |
---|---|---|
hd |
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 |
---|---|---|
hd |
HDate | number
|
Hebrew date or R.D. days |
sedra.find(parsha) ⇒ HDate
| null
Returns the date that a parsha occurs
or null
if the parsha doesn't occur this year
Kind: instance method of Sedra
Param | Type |
---|---|
parsha |
number | string | Array.<string>
|
Returns the underlying annual sedra schedule.
Used by @hebcal/triennial
Kind: instance method of Sedra
R.D. date of the first Saturday on or after Rosh Hashana
Kind: instance method of Sedra
Kind: instance method of Sedra
Returns an object describing the parsha on the first Saturday on or after hd
Kind: instance method of Sedra
Param | Type | Description |
---|---|---|
hd |
HDate | number
|
Hebrew date or R.D. days |
Gregorian date helper functions.
The 54 parshiyot of the Torah as transilterated strings parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[52] == "Ha'azinu".
Kind: global variable
Read only: true
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) / אדר ב׳ |
Calculates yahrzeit.
hyear
must be after original date
of death.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The customary anniversary date of a death is more complicated and depends also on the character of the year in which the first anniversary occurs. There are several cases:
- 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: global function
Returns: Date
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number |
Hebrew year |
date |
Date | SimpleHebrewDate | number
|
Gregorian or Hebrew date of death |
Example
import {getYahrzeit} from '@hebcal/hdate';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const anniversary = getYahrzeit(5780, dt); // '2/25/2020' == '30 Sh\'vat 5780'
Calculates a birthday or anniversary (non-yahrzeit).
hyear
must be after original date
of anniversary.
Returns undefined
when requested year preceeds or is same as original year.
Hebcal uses the algorithm defined in "Calendrical Calculations" by Edward M. Reingold and Nachum Dershowitz.
The birthday of someone born in Adar of an ordinary year or Adar II of a leap year is also always in the last month of the year, be that Adar or Adar II. The birthday in an ordinary year of someone born during the first 29 days of Adar I in a leap year is on the corresponding day of Adar; in a leap year, the birthday occurs in Adar I, as expected.
Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I has his birthday postponed until the first of the following month in years where that day does not occur. [Calendrical Calculations p. 111]
Kind: global function
Returns: Date
- anniversary occurring in hyear
Param | Type | Description |
---|---|---|
hyear | number |
Hebrew year |
date |
Date | SimpleHebrewDate | number
|
Gregorian or Hebrew date of event |
Example
import {getBirthdayOrAnniversary} from '@hebcal/hdate';
const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
const anniversary = getBirthdayOrAnniversary(5780, dt); // '3/26/2020' == '1 Nisan 5780'
Returns a string similar to Date.toISOString()
but in the
timezone tzid
. Contrary to the typical meaning of Z
at the end
of the string, this is not actually a UTC date.
Kind: global function
Param | Type |
---|---|
tzid | string |
date | Date |
Returns number of minutes tzid
is offset from UTC on date date
.
Kind: global function
Param | Type |
---|---|
tzid | string |
date | Date |
Formats a number with leading zeros so the resulting string is 4 digits long.
Similar to string.padStart(4, '0')
but will also format
negative numbers similar to how the JavaScript date formats
negative year numbers (e.g. -37
is formatted as -000037
).
Kind: global function
Param | Type |
---|---|
number | number |
Formats a number with leading zeros so the resulting string is 2 digits long.
Similar to string.padStart(2, '0')
.
Kind: global function
Param | Type |
---|---|
number | number |
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 |
---|---|
num | number |
Example
gematriya(5774) // 'תשע״ד' - cropped to 774
gematriya(25) // 'כ״ה'
gematriya(60) // 'ס׳'
gematriya(3761) // 'ג׳תשס״א'
gematriya(1123) // 'א׳קכ״ג'
Converts a string of Hebrew letters to a numerical value.
Only considers the value of Hebrew letters א
through ת
.
Ignores final Hebrew letters such as ך
(kaf sofit) or ם
(mem sofit)
and vowels (nekudot).
Kind: global function
Param | Type |
---|---|
str | string |
Converts Hebrew date to R.D. (Rata Die) fixed days. R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian Calendar.
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
month | number |
Hebrew month |
day | number |
Hebrew date (1-30) |
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.
Converts absolute R.D. days to Hebrew date
Kind: global function
Param | Type | Description |
---|---|---|
abs | number |
absolute R.D. days |
Returns true if Hebrew year is a leap year
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Number of months in this Hebrew year (either 12 or 13 depending on leap year)
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Number of days in Hebrew month in a given year (29 or 30)
Kind: global function
Param | Type | Description |
---|---|---|
month | number |
Hebrew month (e.g. months.TISHREI) |
year | number |
Hebrew year |
Returns a transliterated string name of Hebrew month in year, for example 'Elul' or 'Cheshvan'.
Kind: global function
Param | Type | Description |
---|---|---|
month | number |
Hebrew month (e.g. months.TISHREI) |
year | number |
Hebrew year |
Days from sunday prior to start of Hebrew calendar to mean conjunction of Tishrei in Hebrew YEAR
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Number of days in the hebrew YEAR. A common Hebrew calendar year can have a length of 353, 354 or 355 days A leap Hebrew calendar year can have a length of 383, 384 or 385 days
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
true if Cheshvan is long in Hebrew year
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
true if Kislev is short in Hebrew year
Kind: global function
Param | Type | Description |
---|---|---|
year | number |
Hebrew year |
Converts Hebrew month string name to numeric
Kind: global function
Param | Type | Description |
---|---|---|
monthName | string |
monthName |
Calculates the molad for a Hebrew month
Returns the sefira. For example, on day 8 חֶֽסֶד שֶׁבִּגְבוּרָה Chesed shebiGevurah Lovingkindness within Might
Kind: global function
Returns: a string such as Lovingkindness within Might
or חֶֽסֶד שֶׁבִּגְבוּרָה
Param | Description |
---|---|
omerDay | the day of the omer, 1-49 inclusive |
lang |
en (English), he (Hebrew with nikud), or translit (Hebrew in Sephardic transliteration) |
Returns a sentence with that evening's omer count
Kind: global function
Returns: a string such as Today is 10 days, which is 1 week and 3 days of the Omer
or הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר
Param | Description |
---|---|
omerDay | the day of the omer, 1-49 inclusive |
lang |
en (English), he (Hebrew with nikud) |
Returns an emoji number symbol with a circle, for example ㊲
from the “Enclosed CJK Letters and Months” block of the Unicode standard
Kind: global function
Returns: a single Unicode character from ①
through ㊾
Param | Description |
---|---|
omerDay | the day of the omer, 1-49 inclusive |