Revert "[Intl] Use new getDefaultHourCycle to replace old hack"
This reverts commit 611e412768
.
Reason for revert: https://crbug.com/1080367
Original change's description:
> [Intl] Use new getDefaultHourCycle to replace old hack
>
> Use the ICU 67.1 new API DateTimePatternGenerator::getDefaultHourCycle
> to replace a hack which get the pattern of "jjmm" to find out the
> default hour cycle of a locale
> Bump the required API version from 65 to 67
>
> Bug: v8:10225
> Change-Id: I3378edacb6dfb8400357ac0bf3d5d50b9fe008bd
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2173875
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67549}
TBR=jkummerow@chromium.org,ftang@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: v8:10225
Change-Id: I8bdfbdfc6c906814e5a7525cbde79c9cac854bd1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208811
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67929}
This commit is contained in:
parent
ccd5395765
commit
3b1d24cf47
@ -21,7 +21,7 @@
|
||||
#include "unicode/locid.h"
|
||||
#include "unicode/uversion.h"
|
||||
|
||||
#define V8_MINIMUM_ICU_VERSION 67
|
||||
#define V8_MINIMUM_ICU_VERSION 65
|
||||
|
||||
namespace U_ICU_NAMESPACE {
|
||||
class BreakIterator;
|
||||
|
@ -59,21 +59,6 @@ JSDateTimeFormat::HourCycle ToHourCycle(const std::string& hc) {
|
||||
return JSDateTimeFormat::HourCycle::kUndefined;
|
||||
}
|
||||
|
||||
JSDateTimeFormat::HourCycle ToHourCycle(UDateFormatHourCycle hc) {
|
||||
switch (hc) {
|
||||
case UDAT_HOUR_CYCLE_11:
|
||||
return JSDateTimeFormat::HourCycle::kH11;
|
||||
case UDAT_HOUR_CYCLE_12:
|
||||
return JSDateTimeFormat::HourCycle::kH12;
|
||||
case UDAT_HOUR_CYCLE_23:
|
||||
return JSDateTimeFormat::HourCycle::kH23;
|
||||
case UDAT_HOUR_CYCLE_24:
|
||||
return JSDateTimeFormat::HourCycle::kH24;
|
||||
default:
|
||||
return JSDateTimeFormat::HourCycle::kUndefined;
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<JSDateTimeFormat::HourCycle> GetHourCycle(Isolate* isolate,
|
||||
Handle<JSReceiver> options,
|
||||
const char* method) {
|
||||
@ -1558,8 +1543,9 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
|
||||
generator_cache.Pointer()->CreateGenerator(icu_locale));
|
||||
|
||||
// 15.Let hcDefault be dataLocaleData.[[hourCycle]].
|
||||
HourCycle hc_default = ToHourCycle(generator->getDefaultHourCycle(status));
|
||||
icu::UnicodeString hour_pattern = generator->getBestPattern("jjmm", status);
|
||||
CHECK(U_SUCCESS(status));
|
||||
HourCycle hc_default = HourCycleFromPattern(hour_pattern);
|
||||
|
||||
// 16.Let hc be r.[[hc]].
|
||||
HourCycle hc = HourCycle::kUndefined;
|
||||
|
Loading…
Reference in New Issue
Block a user