Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3444,7 +3444,7 @@ public Instant getTchilasZmanKidushLevana3Days(Instant alos, Instant tzais) {
//Get the following month's zman kiddush Levana for the extreme case of Rapa Iti in French Polynesia on Dec 2027 when
// kiddush Levana can be said on Rosh Chodesh (the evening of the 30th). See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (page 32)
if (zman == null && jewishCalendar.getJewishDayOfMonth() == 30) {
jewishCalendar.forward(Calendar.MONTH, 1);
jewishCalendar.addMonths(1);
zman = getMoladBasedTime(jewishCalendar.getTchilasZmanKidushLevana3Days(), null, null, true);
}

Expand Down Expand Up @@ -3476,7 +3476,7 @@ public Instant getZmanMolad() {

// deal with molad that happens on the end of the previous month
if (molad == null && jewishCalendar.getJewishDayOfMonth() > 26) {
jewishCalendar.forward(Calendar.MONTH, 1);
jewishCalendar.addMonths(1);
molad = getMoladBasedTime(jewishCalendar.getMoladAsInstant(), null, null, true);
}
return molad;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,7 @@ public void setCandleLightingOffset(double candleLightingOffset) {
*/
public boolean isAssurBemlacha(Instant currentTime, Instant tzais, boolean inIsrael) {
JewishCalendar jewishCalendar = new JewishCalendar();
jewishCalendar.setGregorianDate(getLocalDate().getYear(), getLocalDate().getMonthValue(),
getLocalDate().getDayOfMonth());
jewishCalendar.setGregorianDate(getLocalDate());

jewishCalendar.setInIsrael(inIsrael);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public String formatDayOfWeek(JewishDate jewishDate) {
return getTransliteratedShabbosDayOfWeek().substring(0,3);
}
} else {
return weekFormat.format(jewishDate.getGregorianCalendar().getTime());
return weekFormat.format(jewishDate.getLocalDate());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Calendar; // We still use the old Calendar.WEEKDAY constants

/**
* The JewishCalendar extends the JewishDate class and adds calendar methods.
Expand Down Expand Up @@ -506,12 +507,12 @@ public Parsha getUpcomingParshah() {
JewishCalendar clone = (JewishCalendar) clone();
int daysToShabbos = (Calendar.SATURDAY - getDayOfWeek() + 7) % 7;
if (getDayOfWeek() != Calendar.SATURDAY) {
clone.forward(Calendar.DATE, daysToShabbos);
clone.addDays(daysToShabbos);
} else {
clone.forward(Calendar.DATE, 7);
clone.addDays( 7);
}
while(clone.getParshah() == Parsha.NONE) { //Yom Kippur / Sukkos or Pesach with 2 potential non-parsha Shabbosim in a row
clone.forward(Calendar.DATE, 7);
clone.addDays(7);
}
return clone.getParshah();
}
Expand Down Expand Up @@ -1233,16 +1234,9 @@ public Instant getMoladAsInstant() {
int seconds = (int) moladSeconds;
int nanos = (int) ((moladSeconds - seconds) * 1_000_000_000); // convert remainder to nanos

ZonedDateTime moladZdt = ZonedDateTime.of(
molad.getGregorianYear(),
molad.getGregorianMonth() + 1, // 1-based FIXME
molad.getGregorianDayOfMonth(),
molad.getMoladHours(),
molad.getMoladMinutes(),
seconds,
nanos,
jerusalemStandardOffset
);
LocalTime time = LocalTime.of(molad.getMoladHours(),molad.getMoladMinutes(),seconds,nanos);

ZonedDateTime moladZdt = ZonedDateTime.of(molad.getLocalDate(),time,jerusalemStandardOffset);

// Har Habayis at a longitude of 35.2354 offset vs longitude 35 in standard time, so we subtract the time difference
// of 20.94 minutes (20 minutes and 56 seconds and 496 millis) to get to Standard time from local mean time
Expand Down Expand Up @@ -1402,9 +1396,9 @@ public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof JewishCalendar)) {
return false;
}
if (object == null || getClass() != object.getClass()) {
return false;
}
JewishCalendar jewishCalendar = (JewishCalendar) object;
return getAbsDate() == jewishCalendar.getAbsDate() && getInIsrael() == jewishCalendar.getInIsrael();
}
Expand All @@ -1414,9 +1408,8 @@ public boolean equals(Object object) {
* @see Object#hashCode()
*/
public int hashCode() {
int result = 17;
result = 37 * result + getClass().hashCode(); // needed or this and subclasses will return identical hash
result += 37 * result + getAbsDate() + (getInIsrael() ? 1 : 3);
return result;
int result = Integer.hashCode(getAbsDate());
result = 31 * result + Boolean.hashCode(getInIsrael());
return result;
}
}
Loading
Loading