Skip to content
Permalink
Browse files

Options for formatting years ending in מנצפ״ך

The default is now using non-final form for years ending in מנצפ״ך, so that 5780 will be default format as תש״פ, while it can optionally be set to format it as תש״ף.
  • Loading branch information...
KosherJava committed Oct 6, 2019
1 parent 5447d67 commit 2664599cb770f8d7c819a71a4ad700ed246e6132
Showing with 31 additions and 2 deletions.
  1. +31 −2 src/net/sourceforge/zmanim/hebrewcalendar/HebrewDateFormatter.java
@@ -39,6 +39,7 @@
private boolean useLonghebrewYears = false;
private boolean useGershGershayim = true;
private boolean longWeekFormat = true;
private boolean useFinalFormLetters = false;
private SimpleDateFormat weekFormat = null;

/**
@@ -372,6 +373,31 @@ public void setUseGershGershayim(boolean useGershGershayim) {
this.useGershGershayim = useGershGershayim;
}

/**
* Returns whether the class is set to use the מנצפ״ך letters when
* formatting years ending in 20, 40, 50, 80 and 90. Traditionally non-final form letters are used, so the year
* 5780 would be formatted as תש״פ if the default false is used here. If this returns
* true, the format תש״ף would be used.
*
* @return true if set to use final form letters when formatting Hebrew years. The default value is false.
*/
public boolean isUseFinalFormLetters() {
return useFinalFormLetters;
}

/**
* When formatting a Hebrew Year, traditionally years ending in 20, 40, 50, 80 and 90 are formatted using non-final
* form letters for example תש״פ for the year 5780. Setting this to true (the default
* is false) will use the final form letters for מנצפ״ך and will format
* the year 5780 as תש״ף.
*
* @param useFinalFormLetters
* Set this to true to use final form letters when formatting Hebrew years.
*/
public void setUseFinalFormLetters(boolean useFinalFormLetters) {
this.useFinalFormLetters = useFinalFormLetters;
}

/**
* Returns whether the class is set to use the thousands digit when formatting. When formatting a Hebrew Year,
* traditionally the thousands digit is omitted and output for a year such as 5729 (1969 Gregorian) would be
@@ -396,7 +422,6 @@ public boolean isUseLongHebrewYears() {
public void setUseLongHebrewYears(boolean useLongHebrewYears) {
this.useLonghebrewYears = useLongHebrewYears;
}

/**
* Formats the Jewish date. If the formatter is set to Hebrew, it will format in the form, "day Month year" for
* example כ״א שבט תשכ״ט, and the format
@@ -628,7 +653,11 @@ public String formatHebrewNumber(int number) {
int tens = number / 10;
if (number % 10 == 0) { // if evenly divisable by 10
if (singleDigitNumber == false) {
sb.append(jTenEnds[tens]); // end letters so years like 5750 will end with an end nun
if(isUseFinalFormLetters()) {
sb.append(jTenEnds[tens]); // years like 5780 will end with a final form ף
} else {
sb.append(jTens[tens]); // years like 5780 will end with a regular פ
}
} else {
sb.append(jTens[tens]); // standard letters so years like 5050 will end with a regular nun
}

0 comments on commit 2664599

Please sign in to comment.
You can’t perform that action at this time.