Skip to content

Commit

Permalink
Calendar constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnemonic78 committed Jul 7, 2024
1 parent 44f2655 commit 5075e61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,15 +772,15 @@ public String formatMonth(JewishDate jewishDate) {
final int month = jewishDate.getJewishMonth();
if (isHebrewFormat()) {
if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR) {
return hebrewMonths[13] + (useGershGershayim ? GERESH : ""); // return Adar I, not Adar in a leap year
return hebrewMonths[JewishDate.ADAR_II] + (useGershGershayim ? GERESH : ""); // return Adar I, not Adar in a leap year
} else if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR_II) {
return hebrewMonths[12] + (useGershGershayim ? GERESH : "");
return hebrewMonths[JewishDate.ADAR] + (useGershGershayim ? GERESH : "");
} else {
return hebrewMonths[month - 1];
}
} else {
if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR) {
return transliteratedMonths[13]; // return Adar I, not Adar in a leap year
return transliteratedMonths[JewishDate.ADAR_II]; // return Adar I, not Adar in a leap year
} else {
return transliteratedMonths[month - 1];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class JewishDate implements Comparable<JewishDate>, Cloneable {
/** The number of <em>chalakim</em> (1080) in an hour.*/
private static final int CHALAKIM_PER_HOUR = 1080;
/** The number of <em>chalakim</em> (25,920) in a 24-hour day .*/
private static final int CHALAKIM_PER_DAY = 25920; // 24 * 1080
private static final long CHALAKIM_PER_DAY = 25920; // 24 * 1080
/** The number of <em>chalakim</em> in an average Jewish month. A month has 29 days, 12 hours and 793
* <em>chalakim</em> (44 minutes and 3.3 seconds) for a total of 765,433 <em>chalakim</em>*/
private static final long CHALAKIM_PER_MONTH = 765433; // (29 * 24 + 12) * 1080 + 793
Expand Down Expand Up @@ -460,8 +460,8 @@ private static int getLastMonthOfJewishYear(int year) {
*/
public static int getJewishCalendarElapsedDays(int year) {
long chalakimSince = getChalakimSinceMoladTohu(year, TISHREI);
int moladDay = (int) (chalakimSince / (long) CHALAKIM_PER_DAY);
int moladParts = (int) (chalakimSince - moladDay * (long) CHALAKIM_PER_DAY);
int moladDay = (int) (chalakimSince / CHALAKIM_PER_DAY);
int moladParts = (int) (chalakimSince - moladDay * CHALAKIM_PER_DAY);
// delay Rosh Hashana for the 4 dechiyos
return addDechiyos(year, moladDay, moladParts);
}
Expand Down Expand Up @@ -908,8 +908,8 @@ private static int moladToAbsDate(long chalakim) {
public JewishDate(long molad) {
absDateToDate(moladToAbsDate(molad));
// long chalakimSince = getChalakimSinceMoladTohu(year, TISHREI);// tishrei
int conjunctionDay = (int) (molad / (long) CHALAKIM_PER_DAY);
int conjunctionParts = (int) (molad - conjunctionDay * (long) CHALAKIM_PER_DAY);
int conjunctionDay = (int) (molad / CHALAKIM_PER_DAY);
int conjunctionParts = (int) (molad - conjunctionDay * CHALAKIM_PER_DAY);
setMoladTime(conjunctionParts);
}

Expand Down

0 comments on commit 5075e61

Please sign in to comment.