diff --git a/intl/icu-patches/bug-1954138-ICU-23069-rosh-hashanah-postponement.diff b/intl/icu-patches/bug-1954138-ICU-23069-rosh-hashanah-postponement.diff new file mode 100644 index 000000000000..bbdbf9130b00 --- /dev/null +++ b/intl/icu-patches/bug-1954138-ICU-23069-rosh-hashanah-postponement.diff @@ -0,0 +1,24 @@ +diff --git a/intl/icu/source/i18n/hebrwcal.cpp b/intl/icu/source/i18n/hebrwcal.cpp +--- a/intl/icu/source/i18n/hebrwcal.cpp ++++ b/intl/icu/source/i18n/hebrwcal.cpp +@@ -441,19 +441,18 @@ int32_t startOfYear(int32_t year, UError + day = months * 29LL + frac / DAY_PARTS; // Whole # part of calculation + frac = frac % DAY_PARTS; // Time of day + + int32_t wd = (day % 7); // Day of week (0 == Monday) + + if (wd == 2 || wd == 4 || wd == 6) { + // If the 1st is on Sun, Wed, or Fri, postpone to the next day + day += 1; +- wd = (day % 7); + } +- if (wd == 1 && frac > 15*HOUR_PARTS+204 && !HebrewCalendar::isLeapYear(year) ) { ++ else if (wd == 1 && frac > 15*HOUR_PARTS+204 && !HebrewCalendar::isLeapYear(year) ) { + // If the new moon falls after 3:11:20am (15h204p from the previous noon) + // on a Tuesday and it is not a leap year, postpone by 2 days. + // This prevents 356-day years. + day += 2; + } + else if (wd == 0 && frac > 21*HOUR_PARTS+589 && HebrewCalendar::isLeapYear(year-1) ) { + // If the new moon falls after 9:32:43 1/3am (21h589p from yesterday noon) + // on a Monday and *last* year was a leap year, postpone by 1 day. diff --git a/intl/icu/source/i18n/hebrwcal.cpp b/intl/icu/source/i18n/hebrwcal.cpp index 70dfe9b7c735..5019b334b12f 100644 --- a/intl/icu/source/i18n/hebrwcal.cpp +++ b/intl/icu/source/i18n/hebrwcal.cpp @@ -445,9 +445,8 @@ int32_t startOfYear(int32_t year, UErrorCode &status) if (wd == 2 || wd == 4 || wd == 6) { // If the 1st is on Sun, Wed, or Fri, postpone to the next day day += 1; - wd = (day % 7); } - if (wd == 1 && frac > 15*HOUR_PARTS+204 && !HebrewCalendar::isLeapYear(year) ) { + else if (wd == 1 && frac > 15*HOUR_PARTS+204 && !HebrewCalendar::isLeapYear(year) ) { // If the new moon falls after 3:11:20am (15h204p from the previous noon) // on a Tuesday and it is not a leap year, postpone by 2 days. // This prevents 356-day years. diff --git a/intl/update-icu.sh b/intl/update-icu.sh index 1d767d871d76..d8d07ee7bd59 100755 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -61,6 +61,7 @@ for patch in \ double-conversion.diff \ bug-1856290-ICU-20548-dateinterval-timezone.diff \ bug-1954138-dtitvfmt-adopt-calendar.diff \ + bug-1954138-ICU-23069-rosh-hashanah-postponement.diff \ ; do echo "Applying local patch $patch" patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch