From 4ea9efd6829f765d0c3c51da4fc7a40d007da480 Mon Sep 17 00:00:00 2001 From: wangrx Date: Mon, 5 Feb 2024 15:46:50 +0800 Subject: [PATCH] Fix intl/date-format/format-with-extensions.js and intl/date-format/calendar-with-multiple-type-subtags.js --- ecmascript/js_date_time_format.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ecmascript/js_date_time_format.cpp b/ecmascript/js_date_time_format.cpp index 28dc11ef4a..15a861bdcf 100644 --- a/ecmascript/js_date_time_format.cpp +++ b/ecmascript/js_date_time_format.cpp @@ -414,6 +414,12 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus"); UErrorCode status = U_ZERO_ERROR; + if (numberingSystem->IsUndefined()) { + std::string numberingSystemStr = JSLocale::GetNumberingSystem(icuLocale); + auto result = factory->NewFromStdString(numberingSystemStr); + dateTimeFormat->SetNumberingSystem(thread, result); + } + // Set resolvedIcuLocaleCopy to a copy of icuLocale. // Set icuLocale.[[ca]] to calendar. // Set icuLocale.[[nu]] to numberingSystem. @@ -1010,6 +1016,8 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandleGetHandledEthioaaString().GetTaggedValue()); + } else if (icuCalendar.length() != 0) { + calendarValue.Update(factory->NewFromStdString(icuCalendar).GetTaggedValue()); } property = globalConst->GetHandledCalendarString(); JSObject::CreateDataPropertyOrThrow(thread, options, property, calendarValue); -- Gitee