Jewish Date
The JewishDate is the base calendar class, that supports maintenance of a LocalDateTime instance along with the corresponding Jewish date. This class can use the standard Java (TODO change for kotlin) Date and Calendar classes for setting and maintaining the dates, but it does not subclass these classes or use them internally in any calculations. This class also does not have a concept of a time (which the Date class does). Please note that the calendar does not currently support dates prior to 1/1/1 Gregorian. Also keep in mind that the Gregorian calendar started on October 15, 1582, so any calculations prior to that are suspect (at least from a Gregorian perspective). While 1/1/1 Gregorian and forward are technically supported, any calculations prior to Hillel II's (Hakatan's) calendar (4119 in the Jewish Calendar / 359 CE Julian as recorded by Rav Hai Gaon) would be just an approximation.
This open source Java code was written 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.
Some of Avrom's original C++ code was translated from C/C++ code in Calendrical Calculations by Nachum Dershowitz and Edward M. Reingold, Software-- Practice & Experience, vol. 20, no. 9 (September, 1990), pp. 899- 928. Any method with the mark "ND+ER" indicates that the method was taken from this source with minor modifications.
If you are looking for a class that implements a Jewish calendar version of the Calendar class, one is available from the ICU (International Components for Unicode) project, formerly part of IBM's DeveloperWorks.
Author
Avrom Finkelstien 2002
Eliyahu Hershfeld 2011 - 2021
See also
Inheritors
Constructors
Constructor that creates a JewishDate based on a molad passed in. The molad would be the number of chalakim/parts starting at the beginning of Sunday prior to the molad Tohu BeHaRaD (Be = Monday, Ha= 5 hours and Rad =204 chalakim/parts) - prior to the start of the Jewish calendar. BeHaRaD is 23:11:20 on Sunday night(5 hours 204/1080 chalakim after sunset on Sunday evening).
Creates a Jewish date based on a Jewish year, month and day of month.
Default constructor will set a default date to the current system date.
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 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 this object's date as a LocalDate object.
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 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.
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.
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.
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.