Skip to content

Commit 3b1d24c

Browse files
ngzhianCommit Bot
authored andcommitted
Revert "[Intl] Use new getDefaultHourCycle to replace old hack"
This reverts commit 611e412. 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 <[email protected]> > Commit-Queue: Frank Tang <[email protected]> > Cr-Commit-Position: refs/heads/master@{#67549} [email protected],[email protected] # 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 <[email protected]> Reviewed-by: Jakob Kummerow <[email protected]> Commit-Queue: Zhi An Ng <[email protected]> Cr-Commit-Position: refs/heads/master@{#67929}
1 parent ccd5395 commit 3b1d24c

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

src/objects/intl-objects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "unicode/locid.h"
2222
#include "unicode/uversion.h"
2323

24-
#define V8_MINIMUM_ICU_VERSION 67
24+
#define V8_MINIMUM_ICU_VERSION 65
2525

2626
namespace U_ICU_NAMESPACE {
2727
class BreakIterator;

src/objects/js-date-time-format.cc

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,6 @@ JSDateTimeFormat::HourCycle ToHourCycle(const std::string& hc) {
5959
return JSDateTimeFormat::HourCycle::kUndefined;
6060
}
6161

62-
JSDateTimeFormat::HourCycle ToHourCycle(UDateFormatHourCycle hc) {
63-
switch (hc) {
64-
case UDAT_HOUR_CYCLE_11:
65-
return JSDateTimeFormat::HourCycle::kH11;
66-
case UDAT_HOUR_CYCLE_12:
67-
return JSDateTimeFormat::HourCycle::kH12;
68-
case UDAT_HOUR_CYCLE_23:
69-
return JSDateTimeFormat::HourCycle::kH23;
70-
case UDAT_HOUR_CYCLE_24:
71-
return JSDateTimeFormat::HourCycle::kH24;
72-
default:
73-
return JSDateTimeFormat::HourCycle::kUndefined;
74-
}
75-
}
76-
7762
Maybe<JSDateTimeFormat::HourCycle> GetHourCycle(Isolate* isolate,
7863
Handle<JSReceiver> options,
7964
const char* method) {
@@ -1558,8 +1543,9 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
15581543
generator_cache.Pointer()->CreateGenerator(icu_locale));
15591544

15601545
// 15.Let hcDefault be dataLocaleData.[[hourCycle]].
1561-
HourCycle hc_default = ToHourCycle(generator->getDefaultHourCycle(status));
1546+
icu::UnicodeString hour_pattern = generator->getBestPattern("jjmm", status);
15621547
CHECK(U_SUCCESS(status));
1548+
HourCycle hc_default = HourCycleFromPattern(hour_pattern);
15631549

15641550
// 16.Let hc be r.[[hc]].
15651551
HourCycle hc = HourCycle::kUndefined;

0 commit comments

Comments
 (0)