Jewish Calendar
The JewishCalendar extends the JewishDate class and adds calendar methods.
This open source Java 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.
Author
Y. Paritcher 2019 - 2022
Avrom Finkelstien 2002
Eliyahu Hershfeld 2011 - 2023
See also
Constructors
Default constructor will set a default date to the current system date.
A constructor that initializes the date to the Date parameter.
A constructor that initializes the date to the date parameter.
A constructor that initializes the hebrew date to the date parameter.
A constructor that initializes the date to the date parameter.
A constructor that initializes the date to the date parameter.
A constructor that initializes the hebrew date to the date parameter.
A constructor that initializes the heberew date to the date parameter.
Creates a Jewish date based on a Jewish year, month and day of month.
Creates a Jewish date based on a Jewish date and whether in Israel
Creates a Jewish date based on a Jewish date and whether in Israel
Types
List of parshiyos or special Shabasos. NONE indicates a week without a parsha, while the enum for the parsha of .VZOS_HABERACHA exists for consistency, but is not currently used. The special Shabasos of Shekalim, Zachor, Para, Hachodesh, as well as Shabbos Shuva, Shira, Hagadol, Chazon and Nachamu are also represented in this collection of parshiyos.
Properties
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.
Returns the Daf Yomi (Bavli) for the date that the LocalDate is set to. See the HebrewDateFormatter.formatDafYomiBavli for the ability to format the daf in Hebrew or transliterated masechta names.
Returns the Daf Yomi (Yerushalmi) for the date that the LocalDate is set to. See the HebrewDateFormatter.formatDafYomiYerushalmi for the ability to format the daf in Hebrew or transliterated masechta names.
Returns the day of Chanukah or -1 if it is not Chanukah.
Returns the number of days of the Jewish month that the calendar is currently set to.
Returns the number of days for the current year that the calendar is set to.
returns the number of days from Rosh Hashana of the date passed in, to the full date passed in.
Returns true if the day has candle lighting. This will return true on Erev Shabbos, Erev Yom Tov, the first day of Rosh Hashana and the first days of Yom Tov out of Israel. It is identical to calling isTomorrowShabbosOrYomTov.
Returns this object's date as a LocalDate object.
Returns true if the current day is Aseres Yemei Teshuva.
Returns true if it is Shabbos or if it is a Yom Tov day that has a melacha (work) prohibition.
The Monday, Thursday and Monday after the first Shabbos after Rosh Chodesh Cheshvan and Iyar are BeHaB days. If the last Monday of Iyar's BeHaB coincides with PESACH_SHENI, the method currently considers it both Pesach Sheni and BeHaB. As seen in an Ohr Sameach article on the subject The unknown Days: BeHaB Vs. Pesach Sheini? there are some customs that delay the day to various points in the future.
Birkas Hachamah is recited every 28 years based on Tekufas Shmuel (Julian years) that a year is 365.25 days. The Rambam in &&Hilchos Kiddush Hachodesh 9:3 states that tekufas Nissan of year 1 was 7 days + 9 hours before molad Nissan. This is calculated as every 10,227 days (28 * 365.25).
Returns true if the current day is one of the 8 days of Chanukah.
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.
Returns true if the current day is Chol Hamoed of Pesach or Succos.
Returns true if the current day is Chol Hamoed of Pesach.
Returns true if the current day is Chol Hamoed of Succos.
Returns true if the current day is Erev Rosh Chodesh. Returns false for Erev Rosh Hashana.
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, Succos and Hoshana Rabba.
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).
Returns true if the current day is Hoshana Rabba.
Returns true if the current day is Isru Chag. The method returns true for the day following Pesach Shavuos and Succos. It utilizes {@see #inIsrael} to return the proper date.
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.
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.
Returns if the day is Shabbos and Sunday is Rosh Chodesh and the haftorah of Machar Chodesh is read.
Is the calendar set to have Purim demukafim, where Purim is celebrated on Shushan Purim.
Returns if the day is Purim (Shushan Purim in a mukaf choma and regular Purim in a non-mukaf choma).
Returns if the day is Rosh Chodesh. Rosh Hashana will return false
Returns true if the current day is Rosh Hashana.
Returns if the day is Shabbos Mevorchim.
Returns true if the current day is Shmini Atzeres.
Returns true if the current day is Simchas Torah. This will always return false if .getInIsrael
Returns true if the current day is Succos (either the Yom Tov of Succos orChol Hamoed Succos). It will return false for Shmini Atzeres and Simchas Torah.
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.
Returns if the day is Tisha Be'Av (the 9th of Av).
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.
Is the calendar set to use modern Israeli holidays such as Yom Haatzmaut.
Returns true if the current day is Yom Kippur.
Returns true if the current day is Yom Kippur Katan. Returns false for Erev Rosh Hashana, Erev Rosh Chodesh Cheshvan, Teves and Iyyar. If Erev Rosh Chodesh occurs on a Friday or Shabbos, Yom Kippur Katan is moved back to Thursday.
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 fast besides YOM_KIPPUR. Use isAssurBemelacha to find the days that have a prohibition of work.
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.
The Jewish day of month.
Returns the molad for a given year and month. Returns a JewishDate Object set to the date of the molad with the hours, minutes and chalakim 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.
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 (of 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 daylight savings time. Java (TODO correct for Kotlin) will implicitly format the time to the default (or set) Timezone.
the internal count of molad chalakim / parts. Only an object populated with molad, setJewishDate or moladChalakim will have these fields populated. A regular JewishDate object will have this field set to 0.
The molad hours. Only a JewishDate object populated with molad, setJewishDate or moladHours will have this field populated. A regular JewishDate object will have this field set to 0.
The molad minutes. Only an object populated with molad, setJewishDate or moladMinutes will have these fields populated. A regular JewishDate object will have this field set to 0.
Returns this week's Parsha if it is Shabbos. It returns Parsha.NONE if the date is a weekday or if there is no parsha that week (for example Yom Tov that falls on a Shabbos).
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 the Maharil's opinion of calculating it as half way between molad and molad is of the opinion of the Mechaber as well. 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.
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 recited. Callers of this method should consider displaying alos before this time if the zman is between alos and tzais.
Returns a Parsha enum if the Shabbos is one of the four parshiyos of Parsha.SHKALIM, Zachor, Para, Parsha.HACHODESH or Parsha.NONE for a regular Shabbos (or any weekday).
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.
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.
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.
Returns the upcoming Parsha regardless of if it is the weekday or Shabbos (where next Shabbos's Parsha will be returned. This is unlike .getParshah that returns Parsha.NONE if the date is not Shabbos. If the upcoming Shabbos is a Yom Tov and has no Parsha, the following week's Parsha will be returned.
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 HebrewDateFormatter.formatYomTov.
Functions
Rolls the date back by 1 day. It modifies both the Gregorian and Jewish dates accordingly. The API does not currently offer the ability to forward more than one day at a time, or to forward by month or year. If such manipulation is required use the java.util.Calendar class java.util.Calendar.add or java.util.Calendar.roll methods in the following manner.
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.
A method that creates a deep copy of the object.
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 the Calendar class Calendar.add or Calendar.roll methods in the following manner.
Resets this date to the current system date.
Sets the date based on a LocalDateTime object. Modifies the Jewish date as well.
Sets the Gregorian Date, and updates the Jewish date accordingly. Like the Java Calendar A value of 0 is expected for January.
Sets the Jewish Date and updates the Gregorian date accordingly.
sets the Jewish month.