Skip to content

Commit e0069bd

Browse files
committed
Calendar constants.
1 parent 04dc839 commit e0069bd

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/main/java/com/kosherjava/zmanim/hebrewcalendar/HebrewDateFormatter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -772,15 +772,15 @@ public String formatMonth(JewishDate jewishDate) {
772772
final int month = jewishDate.getJewishMonth();
773773
if (isHebrewFormat()) {
774774
if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR) {
775-
return hebrewMonths[13] + (useGershGershayim ? GERESH : ""); // return Adar I, not Adar in a leap year
775+
return hebrewMonths[JewishDate.ADAR_II] + (useGershGershayim ? GERESH : ""); // return Adar I, not Adar in a leap year
776776
} else if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR_II) {
777-
return hebrewMonths[12] + (useGershGershayim ? GERESH : "");
777+
return hebrewMonths[JewishDate.ADAR] + (useGershGershayim ? GERESH : "");
778778
} else {
779779
return hebrewMonths[month - 1];
780780
}
781781
} else {
782782
if (jewishDate.isJewishLeapYear() && month == JewishDate.ADAR) {
783-
return transliteratedMonths[13]; // return Adar I, not Adar in a leap year
783+
return transliteratedMonths[JewishDate.ADAR_II]; // return Adar I, not Adar in a leap year
784784
} else {
785785
return transliteratedMonths[month - 1];
786786
}

src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishDate.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232
* href="http://en.wikipedia.org/wiki/Hillel_II">Hillel II's (Hakatan's</a>) calendar (4119 in the Jewish Calendar / 359
3333
* CE Julian as recorded by <a href="http://en.wikipedia.org/wiki/Hai_Gaon">Rav Hai Gaon</a>) would be just an
3434
* approximation.
35-
*
35+
*
3636
* This open source Java code was written by <a href="http://www.facebook.com/avromf">Avrom Finkelstien</a> from his C++
3737
* code. It was refactored to fit the KosherJava Zmanim API with simplification of the code, enhancements and some bug
3838
* fixing.
39-
*
39+
*
4040
* Some of Avrom's original C++ code was translated from
4141
* <a href="https://web.archive.org/web/20120124134148/http://emr.cs.uiuc.edu/~reingold/calendar.C">C/C++ code</a> in
4242
* <a href="http://www.calendarists.com">Calendrical Calculations</a> by Nachum Dershowitz and Edward M.
4343
* Reingold, Software-- Practice &amp; Experience, vol. 20, no. 9 (September, 1990), pp. 899- 928. Any method with the mark
4444
* "ND+ER" indicates that the method was taken from this source with minor modifications.
45-
*
45+
*
4646
* If you are looking for a class that implements a Jewish calendar version of the Calendar class, one is available from
4747
* the <a href="http://site.icu-project.org/" >ICU (International Components for Unicode)</a> project, formerly part of
4848
* IBM's DeveloperWorks.
@@ -153,7 +153,7 @@ public class JewishDate implements Comparable<JewishDate>, Cloneable {
153153
/** The number of <em>chalakim</em> (1080) in an hour.*/
154154
private static final int CHALAKIM_PER_HOUR = 1080;
155155
/** The number of <em>chalakim</em> (25,920) in a 24-hour day .*/
156-
private static final int CHALAKIM_PER_DAY = 25920; // 24 * 1080
156+
private static final long CHALAKIM_PER_DAY = 25920; // 24 * 1080
157157
/** The number of <em>chalakim</em> in an average Jewish month. A month has 29 days, 12 hours and 793
158158
* <em>chalakim</em> (44 minutes and 3.3 seconds) for a total of 765,433 <em>chalakim</em>*/
159159
private static final long CHALAKIM_PER_MONTH = 765433; // (29 * 24 + 12) * 1080 + 793
@@ -460,8 +460,8 @@ private static int getLastMonthOfJewishYear(int year) {
460460
*/
461461
public static int getJewishCalendarElapsedDays(int year) {
462462
long chalakimSince = getChalakimSinceMoladTohu(year, TISHREI);
463-
int moladDay = (int) (chalakimSince / (long) CHALAKIM_PER_DAY);
464-
int moladParts = (int) (chalakimSince - moladDay * (long) CHALAKIM_PER_DAY);
463+
int moladDay = (int) (chalakimSince / CHALAKIM_PER_DAY);
464+
int moladParts = (int) (chalakimSince - moladDay * CHALAKIM_PER_DAY);
465465
// delay Rosh Hashana for the 4 dechiyos
466466
return addDechiyos(year, moladDay, moladParts);
467467
}
@@ -533,7 +533,7 @@ private static long getChalakimSinceMoladTohu(int year, int month) {
533533
* Returns the number of <em>chalakim</em> (parts - 1080 to the hour) from the original hypothetical <em>Molad Tohu</em>
534534
* to the Jewish year and month that this Object is set to.
535535
*
536-
* @return the number of <em>chalakim</em> (parts - 1080 to the hour) from the original hypothetical <em>Molad Tohu</em>
536+
* @return the number of <em>chalakim</em> (parts - 1080 to the hour) from the original hypothetical <em>Molad Tohu</em>
537537
*/
538538
public long getChalakimSinceMoladTohu() {
539539
return getChalakimSinceMoladTohu(jewishYear, jewishMonth);
@@ -888,8 +888,8 @@ private static int moladToAbsDate(long chalakim) {
888888
*/
889889
public JewishDate(long molad) {
890890
absDateToDate(moladToAbsDate(molad));
891-
int conjunctionDay = (int) (molad / (long) CHALAKIM_PER_DAY);
892-
int conjunctionParts = (int) (molad - conjunctionDay * (long) CHALAKIM_PER_DAY);
891+
int conjunctionDay = (int) (molad / CHALAKIM_PER_DAY);
892+
int conjunctionParts = (int) (molad - conjunctionDay * CHALAKIM_PER_DAY);
893893
setMoladTime(conjunctionParts);
894894
}
895895

@@ -1293,7 +1293,7 @@ public void forward(int field, int amount) {
12931293

12941294
/**
12951295
* Forward the Jewish date by the number of months passed in.
1296-
* FIXME: Deal with forwarding a date such as 30 Nissan by a month. 30 Iyar does not exist. This should be dealt with similar to
1296+
* FIXME: Deal with forwarding a date such as 30 Nissan by a month. 30 Iyar does not exist. This should be dealt with similar to
12971297
* the way that the Java Calendar behaves (not that simple since there is a difference between add() or roll().
12981298
*
12991299
* @throws IllegalArgumentException if the amount is less than 1

0 commit comments

Comments
 (0)