回退 'Pull Request !860 : 【5.0.1-release】DateTimeFomrat.formatRange()在zh-Hant-HK下格式化问题'

This commit is contained in:
zhangdd_ewan 2024-10-26 09:01:28 +00:00 committed by Gitee
parent a9febec085
commit 74ed905610
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -60,7 +60,7 @@ DateTimeFormat::DateTimeFormat(const std::vector<std::string> &localeTags, std::
for (size_t i = 0; i < localeTags.size(); i++) {
std::string curLocale = localeTags[i];
locale = Locale::forLanguageTag(StringPiece(curLocale), status);
if (U_FAILURE(status)) {
if (status != U_ZERO_ERROR) {
status = U_ZERO_ERROR;
continue;
}
@ -601,7 +601,7 @@ std::string DateTimeFormat::FormatRange(int64_t fromMilliseconds, int64_t toMill
calendar->setTime((UDate)fromMilliseconds, status);
auto toCalendar = std::unique_ptr<Calendar>(Calendar::createInstance(locale, status));
if (U_FAILURE(status) || toCalendar == nullptr) {
if (status != U_ZERO_ERROR || toCalendar == nullptr) {
return PseudoLocalizationProcessor("");
}
toCalendar->clear();
@ -652,7 +652,7 @@ void DateTimeFormat::GetResolvedOptions(std::map<std::string, std::string> &map)
} else {
UErrorCode status = U_ZERO_ERROR;
auto numSys = std::unique_ptr<NumberingSystem>(NumberingSystem::createInstance(locale, status));
if (U_SUCCESS(status)) {
if (status != U_ZERO_ERROR) {
map.insert(std::make_pair("numberingSystem", numSys->getName()));
}
}