JewishCalendar class

The JewishCalendar extends the JewishDate class and adds calendar methods.

This open source Dart code was originally ported by Avrom Finkelstien from his C++ code. It was refactored to fit the KosherJava Zmanim API with simplification of the code, enhancements and some bug fixing. The class allows setting whether the holiday and parsha scheme follows the Israel scheme or outside Israel scheme. The default is the outside Israel scheme. The parsha code was ported by Y. Paritcher from his libzmanim code.

TODO: Some do not belong in this class, but here is a partial list of what should still be implemented:

  • Add Isru Chag
  • Mishna yomis etc

See also JewishDate. See also HebrewDateFormatter. © Y Paritcher 2019 © Avrom Finkelstien 2002 © Eliyahu Hershfeld 2011 - 2019

Inheritance

Constructors

JewishCalendar()
Default constructor will set a default date to the current system date.
JewishCalendar.fromDateTime(DateTime dateTime)
A constructor that initializes the date to the Date parameter.
JewishCalendar.initDate(int jewishYear, int jewishMonth, int jewishDayOfMonth, {bool inIsrael = false})
Creates a Jewish date based on a Jewish date and whether in Israel

Properties

hashCode → int
See also Object.hashCode.
no setteroverride
inIsrael ↔ bool
Is the calendar set to Israel, where some holidays have different rules.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

back([Calendar field = Calendar.DATE, int amount = 1]) → void
Rolls the date back by the specified field and amount. Supports Calendar.DATE (default), Calendar.MONTH, and Calendar.YEAR.
inherited
clone() → JewishCalendar
A method that creates a deep copy of the object.
override
compareTo(JewishDate jewishDate) → int
Compares two dates as per the compareTo() method in the Comparable interface. Returns a value less than 0 if this date is "less than" (before) the date, greater than 0 if this date is "greater than" (after) the date, or 0 if they are equal.
inherited
forward([Calendar field = Calendar.DATE, int amount = 1]) → void
Rolls the date, month or year forward by the amount passed in. It modifies both the Gregorian and Jewish dates accordingly. If manipulation beyond the fields supported here is required, use DateTime arithmetic and pass the result back via setDate. For example:
inherited
getAbsDate() → int
Returns the absolute date (days since January 1, 0001 on the Gregorian calendar).
inherited
getChalakimSinceMoladTohu() → double
Returns the number of chalakim (parts - 1080 to the hour) from the original hypothetical Molad Tohu to the Jewish year and month that this Object is set to.
inherited
getCheshvanKislevKviah() → int
Returns the Cheshvan and Kislev kviah (whether a Jewish year is short, regular or long). It will return SHELAIMIM if both cheshvan and kislev are 30 days, KESIDRAN if Cheshvan is 29 days and Kislev is 30 days and CHASERIM if both are 29 days.
inherited
getDafYomiBavli() → Daf
Returns the Daf Yomi (Bavli) for the date that the calendar is set to. See the HebrewDateFormatter.formatDafYomiBavli for the ability to format the daf in Hebrew or transliterated masechta names.
getDafYomiYerushalmi() → Daf
Returns the Daf Yomi (Yerushalmi) for the date that the calendar is set to. See the HebrewDateFormatter.formatDafYomiYerushalmi for the ability to format the daf in Hebrew or transliterated masechta names.
getDayOfChanukah() → int
Returns the day of Chanukah or -1 if it is not Chanukah.
getDayOfOmer() → int
Returns the int value of the Omer day or -1 if the day is not in the omer
getDayOfWeek() → int
Returns the day of the week as a number between 1-7.
inherited
getDaysInJewishMonth() → int
Returns the number of days of the Jewish month that the calendar is currently set to.
inherited
getDaysInJewishYear() → int
Returns the number of days for the current year that the calendar is set to.
inherited
getDaysSinceStartOfJewishYear() → int
returns the number of days from Rosh Hashana of the date passed in, to the full date passed in.
inherited
getGregorianCalendar() → DateTime
Returns this object's date as a DateTime object.
inherited
getGregorianDayOfMonth() → int
Returns the Gregorian day of the month.
inherited
getGregorianMonth() → int
Returns the Gregorian month (between 0-11).
inherited
getGregorianYear() → int
Returns the Gregorian year.
inherited
getJewishDayOfMonth() → int
Returns the Jewish day of month.
inherited
getJewishMonth() → int
Returns the Jewish month 1-12 (or 13 years in a leap year). The month count starts with 1 for Nisan and goes to 13 for Adar II
inherited
getJewishYear() → int
Returns the Jewish year.
inherited
getLastDayOfGregorianMonth(int month) → int
Returns the last day in a gregorian month
inherited
getMolad() → JewishDate
Returns the molad for a given year and month. Returns a JewishDate Object set to the date of the molad with the getMoladHours, getMoladMinutes and getMoladChalakim set. In the current implementation, it sets the molad time based on a midnight date rollover. This means that Rosh Chodesh Adar II, 5771 with a molad of 7 chalakim past midnight on Shabbos 29 Adar I / March 5, 2011 12:00 AM and 7 chalakim, will have the following values: hours: 0, minutes: 0, Chalakim: 7.
inherited
getMoladAsDateTime() → DateTime
Returns the molad in Standard Time in Yerushalayim as a Date. The traditional calculation uses local time. This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the local time (Har Habayis with a longitude of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method intentionally uses standard time and not dailight savings time. Java will implicitly format the time to the default (or set) Timezone.
getMoladChalakim() → int
Returns the molad chalakim/parts. Only an object populated with getMolad, setJewishDate or or setMoladChalakim will have these fields populated. A regular JewishDate object will have this field set to 0.
inherited
getMoladHours() → int
Returns the molad hours. Only a JewishDate object populated with getMolad, setJewishDate or setMoladHours will have this field populated. A regular JewishDate object will have this field set to 0.
inherited
getMoladMinutes() → int
Returns the molad minutes. Only an object populated with getMolad, setJewishDate or or setMoladMinutes will have these fields populated. A regular JewishDate object will have this field set to 0.
inherited
getParshah() → Parsha
Returns this week's Parsha if it is Shabbos. returns Parsha.NONE if a weekday or if there is no parsha that week (for example Yomtov is on Shabbos).
getSofZmanKidushLevana15Days() → DateTime
Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the Rema who brings down the opinion of the Maharil's of calculating getSofZmanKidushLevanaBetweenMoldos is of the opinion that Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid Heber's very detailed writeup in Siman Daled (chapter 4) of Shaarei Zmanim. This method returns the time even if it is during the day when Kiddush Levana can't be said. Callers of this method should consider displaying alos before this time if the zman is between alos and tzais.
getSofZmanKidushLevanaBetweenMoldos() → DateTime
Returns the latest time of Kiddush Levana according to the Maharil's opinion that it is calculated as halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time even if it is during the day when Kiddush Levana can't be said. Callers of this method should consider displaying alos before this time if the zman is between alos and tzais.
getSpecialShabbos() → Parsha
Returns a parsha enum if the Shabbos is one of the four parshiyos of Parsha.SHKALIM, Parsha.ZACHOR, Parsha.PARA, Parsha.HACHODESH or Parsha.NONE for a regular Shabbos (or any weekday).
getTchilasZmanKidushLevana3Days() → DateTime
Returns the earliest time of Kiddush Levana calculated as 3 days after the molad. This method returns the time even if it is during the day when Kiddush Levana can't be said. Callers of this method should consider displaying the next tzais if the zman is between alos and tzais.
getTchilasZmanKidushLevana7Days() → DateTime
Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the Mechaber. See the Bach's opinion on this time. This method returns the time even if it is during the day when Kiddush Levana can't be said. Callers of this method should consider displaying the next tzais if the zman is between alos and tzais.
getTekufasTishreiElapsedDays() → int
Returns the elapsed days since Tekufas Tishrei. This uses Tekufas Shmuel (identical to the Julian Year with a solar year length of 365.25 days. The notation used below is D = days, H = hours and C = chalakim. Molad BaHaRad was 2D,5H,204C or 5H,204C from the start of Rosh Hashana year 1. For molad Nissan add 177D, 4H and 438C (6 * 29D, 12H and 793C), or 177D,9H,642C after Rosh Hashana year 1. Tekufas Nissan was 7D, 9H and 642C before molad Nissan according to the Rambam, or 170D, 0H and 0C after Rosh Hashana year 1. Tekufas Tishrei was 182D and 3H (365.25 / 2) before tekufas Nissan, or 12D and 15H before Rosh Hashana of year 1. Outside of Israel we start reciting Tal Umatar in Birkas Hashanim from 60 days after tekufas Tishrei. The 60 days include the day of the tekufah and the day we start reciting Tal Umatar. 60 days from the tekufah == 47D and 9H from Rosh Hashana year 1.
getYomTovIndex() → int
Returns an index of the Jewish holiday or fast day for the current day, or a -1 if there is no holiday for this day. There are constants in this class representing each Yom Tov. Formatting of the Yomim tovim is done in the ZmanimFormatter# TODO: consider using enums instead of the constant ints. Returns the index of the holiday such as the constant LAG_BAOMER or YOM_KIPPUR or a -1 if it is not a holiday. See also HebreDateFormatter.
hasCandleLighting() → bool
Returns true if tomorrow is Shabbos or Yom Tov. This will return true on erev Shabbos, erev Yom Tov, the first day of Rosh Hashana and erev the first days of Yom Tov out of Israel. It is identical to calling hasCandleLighting.
isAseresYemeiTeshuva() → bool
Returns true if the current day is Aseret Yemei Teshuva.
isAssurBemelacha() → bool
Returns true if it is Shabbos or if it is a Yom Tov day that has a melacha (work) prohibition. This method will return false for a. Returns if the day is a Yom Tov that is assur bemlacha or Shabbos
isBirkasHachamah() → bool
Birkas Hachamah is recited every 28 years based on Tekufas Shmulel (Julian years) that a year is 365.25 days. The Rambam in Hilchos Kiddush Hachodesh 9:3 states that tekufas Nisan of year 1 was 7 days + 9 hours before molad Nisan. This is calculated as every 10,227 days (28 * 365.25). Returns true for a day that Birkas Hachamah is recited.
isChanukah() → bool
Returns true if the current day is one of the 8 days of CHANUKAH. Returns if the current day is one of the 8 days of CHANUKAH. See also getDayOfChanukah.
isCheshvanLong() → bool
Returns if Cheshvan is long (30 days VS 29 days) for the current year that the calendar is set to. The method name isLong is done since in a Kesidran (ordered) year Cheshvan is short.
inherited
isCholHamoed() → bool
Returns true if the current day is Chol Hamoed of Pesach or Succos.
isCholHamoedPesach() → bool
Returns true if the current day is Chol Hamoed of Pesach.
isCholHamoedSuccos() → bool
Returns true if the current day is Chol Hamoed of Succos.
isErevRoshChodesh() → bool
Returns true if the current day is Erev Rosh Chodesh. Returns false for Erev Rosh Hashana
isErevYomTov() → bool
Returns true if the current day is erev Yom Tov. The method returns true for Erev - Pesach (first and last days), Shavuos, Rosh Hashana, Yom Kippur and Succos and Hoshana Rabba.
isErevYomTovSheni() → bool
Returns true if the day is the second day of Yom Tov. This impacts the second day of Rosh Hashana everywhere and the second days of Yom Tov in chutz laaretz (out of Israel).
isGregorianLeapYear(int year) → bool
Returns is the year passed in is a Gregorian leap year.
inherited
isIsruChag() → bool
Returns true if the current day is Isru Chag. The method returns true for the day following Pesach Shavuos and Succos. It utilizes {@see #getInIsrael()} to return the proper date.
isJewishLeapYear() → bool
Returns if the year the calendar is set to is a Jewish leap year. Years 3, 6, 8, 11, 14, 17 and 19 in the 19 year cycle are leap years.
inherited
isKislevShort() → bool
Returns if the Kislev is short for the year that this class is set to. The method name isShort is done since in a Kesidran (ordered) year Kislev is long.
inherited
isMacharChodesh() → bool
Returns if the day is Shabbos and sunday is Rosh Chodesh.
isMashivHaruach() → bool
isMashivHaruachEndDate() → bool
Returns if the date is the end date for reciting Mashiv Haruach Umorid Hageshem. The date is 15 Nissan.
isMashivHaruachRecited() → bool
Returns if Mashiv Haruach Umorid Hageshem is recited. This period starts on 22 Tishrei and ends on the 15th day of Nissan. Marcheshvan. Outside of Israel recitation starts on December 4/5.
isMashivHaruachStartDate() → bool
Returns if the date is the start date for reciting Mashiv Haruach Umorid Hageshem. The date is 22 Tishrei.
isMoridHatalRecited() → bool
Returns if Morid Hatal (or the lack of reciting Mashiv Haruach following nussach Ashkenaz) is recited. This period starts on 22 Tishrei and ends on the 15th day of Nissan.
isRoshChodesh() → bool
Returns if the day is Rosh Chodesh. Rosh Hashana will return false
isShabbosMevorchim() → bool
Returns if the day is Shabbos Mevorchim.
isShoavavimWeek() → bool
return true if this Shoavavim week
isTaanis() → bool
Return true if the day is a Taanis (fast day). Return true for 17 of Tammuz, Tisha B'Av, Yom Kippur, Fast of Gedalyah, 10 of Teves and the Fast of Esther
isTaanisBechoros() → bool
Return true if the day is Taanis Bechoros (on erev Pesach). It will return true for the 14th of Nissan if it is not on Shabbos, or if the 12th of Nissan occurs on a Thursday
isTomorrowShabbosOrYomTov() → bool
Returns true if tomorrow is Shabbos or Yom Tov. This will return true on erev Shabbos, erev Yom Tov, the first day of Rosh Hashana and erev the first days of Yom Tov out of Israel. It is identical to calling hasCandleLighting. Returns will return if the next day is Shabbos or Yom Tov
isUseModernHolidays() → bool
Is this calendar set to return modern Israeli national holidays. By default this value is false. The holidays are: "Yom HaShoah", "Yom Hazikaron", "Yom Ha'atzmaut" and "Yom Yerushalayim"
isVeseinBerachaRecited() → bool
Returns if Vesein Beracha is recited. It is recited from 15 Nissan to the point that {@link #isVeseinTalUmatarRecited() vesein tal umatar is recited}.
isVeseinTalUmatarRecited() → bool
Returns if Vesein Tal Umatar Livracha (Sheailas Geshamim) is recited. This will return true for the entire season, even on Shabbos when it is not recited. Returns true if Vesein Tal Umatar Livracha (Sheailas Geshamim) is recited.
isVeseinTalUmatarStartDate() → bool
Returns if it is the Jewish day (starting the evening before) to start reciting Vesein Tal Umatar Livracha (Sheailas Geshamim). In Israel this is the 7th day of Marcheshvan. Outside Israel recitation starts on the evening of December 4th (or 5th if it is the year before a civil leap year) in the 21st century and shifts a day forward every century not evenly divisible by 400. This method will return true if vesein tal umatar on the current Jewish date that starts on the previous night, so Dec 5/6 will be returned by this method in the 21st century. vesein tal umatar is not recited on Shabbos and the start date will be delayed a day when the start day is on a Shabbos (this can only occur out of Israel).
isVeseinTalUmatarStartingTonight() → bool
Returns if true if tonight is the first night to start reciting Vesein Tal Umatar Livracha ( Sheailas Geshamim). In Israel this is the 7th day of Marcheshvan (so the 6th will return true). Outside Israel recitation starts on the evening of December 4th (or 5th if it is the year before a civil leap year) in the 21st century and shifts a day forward every century not evenly divisible by 400. Vesein tal umatar is not recited on Shabbos and the start date will be delayed a day when the start day is on a Shabbos (this can only occur out of Israel).
isYomTov() → bool
Returns true if the current day is Yom Tov. The method returns true even for holidays such as CHANUKAH and minor ones such as TU_BEAV and PESACH_SHENI. Erev Yom Tov (with the exception of HOSHANA_RABBA, erev the second days of Pesach) returns false, as do isTaanis besides YOM_KIPPUR. Use isAssurBemelacha to find the days that have a prohibition of work.
isYomTovAssurBemelacha() → bool
Returns true if the Yom Tov day has a melacha (work) prohibition. This method will return false for a non-Yom Tov day, even if it is Shabbos.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetDate() → void
Resets this date to the current system date.
inherited
setDate(DateTime dateTime) → void
Sets the date based on a DateTime object. Modifies the Jewish date as well.
inherited
setGregorianDate(int year, int month, int dayOfMonth) → void
Sets the Gregorian Date, and updates the Jewish date accordingly. A value of 0 is expected for January (0-based months).
inherited
setGregorianDayOfMonth(int dayOfMonth) → void
sets the Gregorian Day of month.
inherited
setGregorianMonth(int month) → void
Sets the Gregorian month.
inherited
setGregorianYear(int year) → void
sets the Gregorian year.
inherited
setJewishDate(int year, int month, int dayOfMonth, [int hours = 0, int minutes = 0, int chalakim = 0]) → void
Sets the Jewish Date and updates the Gregorian date accordingly.
inherited
setJewishDayOfMonth(int dayOfMonth) → void
sets the Jewish day of month.
inherited
setJewishMonth(int month) → void
sets the Jewish month.
inherited
setJewishYear(int year) → void
sets the Jewish year.
inherited
setMoladChalakim(int moladChalakim) → void
Sets the molad chalakim/parts. The expectation is that the traditional minute-less chalakim will be broken out to setMoladMinutes and chalakim, so 793 (TaShTZaG) parts would have the minutes set to 44 and chalakim to 1.
inherited
setMoladHours(int moladHours) → void
Sets the molad hours.
inherited
setMoladMinutes(int moladMinutes) → void
Sets the molad minutes. The expectation is that the traditional minute-less chalakim will be broken out to minutes and setMoladChalakim , so 793 (TaShTZaG) parts would have the minutes set to 44 and chalakim to 1.
inherited
setUseModernHolidays(bool useModernHolidays) → void
Seth the calendar to return modern Israeli national holidays. By default this value is false. The holidays are: "Yom HaShoah", "Yom Hazikaron", "Yom Ha'atzmaut" and "Yom Yerushalayim"
toString() → String
Returns a string containing the Jewish date in the form, "day Month, year" e.g. "21 Shevat, 5729". For more complex formatting, use the formatter classes.
inherited

Operators

operator ==(Object object) → bool
See also Object.equals.
override

Constants

CHANUKAH → const int
The holiday of Chanukah. 8 days starting on the 25th day Kislev.
CHOL_HAMOED_PESACH → const int
Chol Hamoed (interim days) of Pesach (Passover)
CHOL_HAMOED_SUCCOS → const int
Chol Hamoed (interim days) of Succos/Sukkos (Tabernacles)
EREV_PESACH → const int
The 14th day of Nisan, the day before of Pesach (Passover).
EREV_ROSH_CHODESH → const int
Rosh Chodesh, the new moon on the first day of the Jewish month, and the 30th day of the previous month in the case of a month with 30 days.
EREV_ROSH_HASHANA → const int
Erev Rosh Hashana (the day before Rosh Hashana), the 29th of Elul
EREV_SHAVUOS → const int
Erev Shavuos (the day before Shavuos), the 5th of Sivan
EREV_SUCCOS → const int
The 14th day of Tishrei, the day before of Succos/Sukkos (Tabernacles).
EREV_YOM_KIPPUR → const int
The 9th day of Tishrei, the day before of Yom Kippur.
FAST_OF_ESTHER → const int
The fast of Esther, usually on the 13th day of Adar (or Adar II on leap years). It is earlier on some years.
FAST_OF_GEDALYAH → const int
The fast of Gedalyah, the 3rd of Tishrei.
HOSHANA_RABBA → const int
Hoshana Rabba, the 7th day of Succos/Sukkos that occurs on the 21st of Tishrei.
ISRU_CHAG → const int
The day following the last day of Pesach, Shavuos and Sukkos.
LAG_BAOMER → const int
The 33rd day of the Omer, the 18th of Iyar, a minor holiday.
parshalist → const List<List<Parsha>>
PESACH → const int
The holiday of Pesach (Passover) on the 15th (and 16th out of Israel) day of Nisan.
PESACH_SHENI → const int
Pesach Sheni, the 14th day of Iyar, a minor holiday.
PURIM → const int
The holiday of Purim on the 14th day of Adar (or Adar II on leap years).
PURIM_KATAN → const int
The holiday of Purim Katan on the 14th day of Adar I on a leap year when Purim is on Adar II, a minor holiday.
ROSH_CHODESH → const int
Yom HaShoah, Holocaust Remembrance Day, usually held on the 27th of Nisan. If it falls on a Friday, it is moved to the 26th, and if it falls on a Sunday it is moved to the 28th. A isUseModernHolidays.
ROSH_HASHANA → const int
Rosh Hashana, the first of Tishrei.
SEVENTEEN_OF_TAMMUZ → const int
The fast of the 17th day of Tamuz
SHAVUOS → const int
Shavuos (Pentecost), the 6th of Sivan
SHEMINI_ATZERES → const int
Shmini Atzeres, the 8th day of Succos/Sukkos is an independent holiday that occurs on the 22nd of Tishrei.
SHUSHAN_PURIM → const int
The holiday of Shushan Purim on the 15th day of Adar (or Adar II on leap years).
SHUSHAN_PURIM_KATAN → const int
The holiday of Purim Katan on the 15th day of Adar I on a leap year when Purim is on Adar II, a minor holiday.
SIMCHAS_TORAH → const int
Simchas Torah, the 9th day of Succos/Sukkos, or the second day of Shmini Atzeres that is celebrated getInIsrael on the 23rd of Tishrei.
SUCCOS → const int
The holiday of Succos/Sukkos (Tabernacles), the 15th (and 16th out of Israel) day of Tishrei
TENTH_OF_TEVES → const int
The fast of the 10th day of Teves.
TISHA_BEAV → const int
The fast of the 9th of Av
TU_BEAV → const int
The 15th day of Av, a minor holiday
TU_BESHVAT → const int
Tu Bishvat on the 15th day of Shevat, a minor holiday.
YOM_HAATZMAUT → const int
Yom Ha'atzmaut, Israel Independence Day, the 5th of Iyar, but if it occurs on a Friday or Saturday, the holiday is moved back to Thursday, the 3rd of 4th of Iyar, and if it falls on a Monday, it is moved forward to Tuesday the 6th of Iyar. A isUseModernHolidays.
YOM_HASHOAH → const int
Yom HaZikaron, Israeli Memorial Day, held a day before Yom Ha'atzmaut. A isUseModernHolidays.
YOM_HAZIKARON → const int
Yom Ha'atzmaut, Israel Independence Day, the 5th of Iyar, but if it occurs on a Friday or Saturday, the holiday is moved back to Thursday, the 3rd of 4th of Iyar, and if it falls on a Monday, it is moved forward to Tuesday the 6th of Iyar. A isUseModernHolidays.
YOM_KIPPUR → const int
The holiday of Yom Kippur, the 10th day of Tishrei
YOM_YERUSHALAYIM → const int
Yom Yerushalayim or Jerusalem Day, on 28 Iyar. A isUseModernHolidays.