bug-1972781-chinese-based-calendar.diff (1301B)
1 diff --git a/intl/icu/source/i18n/smpdtfmt.cpp b/intl/icu/source/i18n/smpdtfmt.cpp 2 --- a/intl/icu/source/i18n/smpdtfmt.cpp 3 +++ b/intl/icu/source/i18n/smpdtfmt.cpp 4 @@ -1523,18 +1523,19 @@ SimpleDateFormat::subFormat(UnicodeStrin 5 } 6 7 switch (patternCharIndex) { 8 9 // for any "G" symbol, write out the appropriate era string 10 // "GGGG" is wide era name, "GGGGG" is narrow era name, anything else is abbreviated name 11 case UDAT_ERA_FIELD: 12 { 13 - if (typeid(cal) == typeid(ChineseCalendar) || 14 - typeid(cal) == typeid(DangiCalendar)) { 15 + const char* type = cal.getType(); 16 + if (strcmp(type, "chinese") == 0 || 17 + strcmp(type, "dangi") == 0) { 18 zeroPaddingNumber(currentNumberFormat,appendTo, value, 1, 9); // as in ICU4J 19 } else { 20 if (count == 5) { 21 _appendSymbol(appendTo, value, fSymbols->fNarrowEras, fSymbols->fNarrowErasCount); 22 capContextUsageType = DateFormatSymbols::kCapContextUsageEraNarrow; 23 } else if (count == 4) { 24 _appendSymbol(appendTo, value, fSymbols->fEraNames, fSymbols->fEraNamesCount); 25 capContextUsageType = DateFormatSymbols::kCapContextUsageEraWide;