Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -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