mirror of
https://gitee.com/openharmony/global_i18n
synced 2024-11-23 07:00:13 +00:00
DateTimeFomrat.formatRange()格式化错误
Signed-off-by: zhangdd_ewan <zhangdongdong50@huawei.com>
This commit is contained in:
parent
8a2f28f41f
commit
2036c696f4
@ -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 (status != U_ZERO_ERROR) {
|
||||
if (U_FAILURE(status)) {
|
||||
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 (status != U_ZERO_ERROR || toCalendar == nullptr) {
|
||||
if (U_FAILURE(status) || 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 (status != U_ZERO_ERROR) {
|
||||
if (U_SUCCESS(status)) {
|
||||
map.insert(std::make_pair("numberingSystem", numSys->getName()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user