Bug 1954138 - Part 6: Add a patch for ICU-23069. r=dminor

Upstream bug report: https://unicode-org.atlassian.net/browse/ICU-23069

Differential Revision: https://phabricator.services.mozilla.com/D241648
This commit is contained in:
André Bargull
2025-04-23 11:23:30 +00:00
parent 1b3f3d0509
commit f3dc372bc8
3 changed files with 26 additions and 2 deletions

View File

@@ -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.

View File

@@ -445,9 +445,8 @@ int32_t startOfYear(int32_t year, UErrorCode &status)
if (wd == 2 || wd == 4 || wd == 6) { if (wd == 2 || wd == 4 || wd == 6) {
// If the 1st is on Sun, Wed, or Fri, postpone to the next day // If the 1st is on Sun, Wed, or Fri, postpone to the next day
day += 1; 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) // 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. // on a Tuesday and it is not a leap year, postpone by 2 days.
// This prevents 356-day years. // This prevents 356-day years.

View File

@@ -61,6 +61,7 @@ for patch in \
double-conversion.diff \ double-conversion.diff \
bug-1856290-ICU-20548-dateinterval-timezone.diff \ bug-1856290-ICU-20548-dateinterval-timezone.diff \
bug-1954138-dtitvfmt-adopt-calendar.diff \ bug-1954138-dtitvfmt-adopt-calendar.diff \
bug-1954138-ICU-23069-rosh-hashanah-postponement.diff \
; do ; do
echo "Applying local patch $patch" echo "Applying local patch $patch"
patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch