An easy-to-use npm package for checking Jewish holidays and Shabbat.
## InstallationTo install the package, run one of the following commands:
npm i jewish-holidaysor with yarn
yarn add jewish-holidaysYou can use the package in your JavaScript projects as shown below:
import { isYomTov, isShabbat } from 'jewish-holidays';
// Check if a date is Yom Tov
const date = new Date();
const isInChutzLaaretz = true; // Adjust as needed
console.log(isYomTov(date, isInChutzLaaretz)); // true or false
// Check if a date is Shabbat
console.log(isShabbat(date)); // true or falseisYomTov(date: Date | BasicJewishDate, isChutzLaaretz: boolean) => booleanDetermines if the given date is a Yom Tov (Jewish holiday).
- date: A JavaScript Date object or a BasicJewishDate object.
- isChutzLaaretz: A boolean indicating if the calculation should consider diaspora holidays.
isShabbat(date: Date | BasicJewishDate) => booleanDetermines if the given date is Shabbat.
- date: A JavaScript Date object or a BasicJewishDate object.
isErevShabbat(date: Date | BasicJewishDate) => booleanDetermines if the given date is Erev Shabbat (Friday).
- date: A JavaScript Date object or a BasicJewishDate object.
isErevYomTov(date: Date | BasicJewishDate) => booleanDetermines if the given date is Erev Yom Tov (the day before a Jewish holiday).
- date: A JavaScript Date object or a BasicJewishDate object.
isCholHaMoed(date: Date | BasicJewishDate, isChutzLaaretz?: boolean) => booleanDetermines if the given date is Chol HaMoed (the intermediate days of Passover or Sukkot).
- date: A JavaScript Date object or a BasicJewishDate object.
- isChutzLaaretz: (optional) A boolean indicating if the calculation should consider diaspora holidays.
isRoshChodesh(date: Date | BasicJewishDate) => booleanDetermines if the given date is Rosh Chodesh (the beginning of a new Jewish month).
- date: A JavaScript Date object or a BasicJewishDate object.
isChanukah(date: Date | BasicJewishDate) => booleanDetermines if the given date is during Chanukah.
- date: A JavaScript Date object or a BasicJewishDate object.
isPurim(date: Date | BasicJewishDate) => booleanDetermines if the given date is Purim.
- date: A JavaScript Date object or a BasicJewishDate object.
isTzom(date: Date | BasicJewishDate) => booleanDetermines if the given date is a Jewish fast day (Tzom).
- date: A JavaScript Date object or a BasicJewishDate object.
MIT