47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
# Allow to set the Gregorian change date for ISO8601 calendars.
|
|
#
|
|
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22412
|
|
|
|
diff --git a/intl/icu/source/i18n/ucal.cpp b/intl/icu/source/i18n/ucal.cpp
|
|
--- a/intl/icu/source/i18n/ucal.cpp
|
|
+++ b/intl/icu/source/i18n/ucal.cpp
|
|
@@ -22,10 +22,11 @@
|
|
#include "unicode/ustring.h"
|
|
#include "unicode/strenum.h"
|
|
#include "unicode/localpointer.h"
|
|
#include "cmemory.h"
|
|
#include "cstring.h"
|
|
+#include "iso8601cal.h"
|
|
#include "ustrenum.h"
|
|
#include "uenumimp.h"
|
|
#include "ulist.h"
|
|
#include "ulocimp.h"
|
|
|
|
@@ -305,11 +306,12 @@ ucal_setGregorianChange(UCalendar *cal,
|
|
// We normally don't check "this" pointers for nullptr, but this here avoids
|
|
// compiler-generated exception-throwing code in case cal == nullptr.
|
|
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
|
return;
|
|
}
|
|
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
|
|
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
|
|
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
|
|
*pErrorCode = U_UNSUPPORTED_ERROR;
|
|
return;
|
|
}
|
|
gregocal->setGregorianChange(date, *pErrorCode);
|
|
}
|
|
@@ -327,11 +329,12 @@ ucal_getGregorianChange(const UCalendar
|
|
// We normally don't check "this" pointers for nullptr, but this here avoids
|
|
// compiler-generated exception-throwing code in case cal == nullptr.
|
|
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
|
return (UDate)0;
|
|
}
|
|
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
|
|
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
|
|
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
|
|
*pErrorCode = U_UNSUPPORTED_ERROR;
|
|
return (UDate)0;
|
|
}
|
|
return gregocal->getGregorianChange();
|
|
}
|