Skip to content

Commit 492fc95

Browse files
targosjuanarbol
authored andcommitted
deps: V8: cherry-pick 90be99fab31c
Original commit message: [intl] Revert date formatting behavior change from ICU 72 Replace U+202F with U+0020 after formatting date. This lets websites continue to work without any changes. This matches Firefox behavior, according to https://bugzilla.mozilla.org/show_bug.cgi?id=1806042#c17. Bug: chromium:1414292, chromium:1401829, chromium:1392814 Change-Id: I7c2b58414d0890f8705e737f903403dc54e5fe57 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4237675 Commit-Queue: Adam Klein <[email protected]> Reviewed-by: Shu-yu Guo <[email protected]> Cr-Commit-Position: refs/heads/main@{#85757} Refs: v8/v8@90be99f PR-URL: #46646 Refs: #46123 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 73a8f46 commit 492fc95

File tree

7 files changed

+32
-7
lines changed

7 files changed

+32
-7
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.24',
39+
'v8_embedder_string': '-node.25',
4040

4141
##### V8 defaults for Node.js #####
4242

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

+5
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,11 @@ MaybeHandle<String> FormatDateTime(Isolate* isolate,
753753
icu::UnicodeString result;
754754
date_format.format(date_value, result);
755755

756+
// Revert ICU 72 change that introduced U+202F instead of U+0020
757+
// to separate time from AM/PM. See https://crbug.com/1414292.
758+
result = result.findAndReplace(icu::UnicodeString(0x202f),
759+
icu::UnicodeString(0x20));
760+
756761
return Intl::ToString(isolate, result);
757762
}
758763

deps/v8/test/mjsunit/mjsunit.status

+3
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@
511511

512512
# Non-BMP characters currently aren't considered identifiers in no_i18n
513513
'harmony/private-name-surrogate-pair': [PASS,FAIL],
514+
515+
# Tests ICU-specific behavior.
516+
'regress/regress-crbug-1414292': [SKIP],
514517
}], # 'no_i18n'
515518

516519
##############################################################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2023 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
const date = new Date("Wed Feb 15 2023 00:00:00 GMT+0100");
6+
const localeString = date.toLocaleString("en-US");
7+
// No narrow-width space should be found
8+
assertEquals(-1, localeString.search('\u202f'));
9+
// Regular space should match the character between time and AM/PM.
10+
assertMatches(/:\d\d:\d\d [AP]M$/, localeString);
11+
12+
const formatter = new Intl.DateTimeFormat('en', {timeStyle: "long"})
13+
const formattedString = formatter.format(date)
14+
// No narrow-width space should be found
15+
assertEquals(-1, formattedString.search('\u202f'));
16+
// Regular space should match the character between time and AM/PM.
17+
assertMatches(/:\d\d:\d\d [AP]M$/, localeString);

deps/v8/test/test262/test262.status

+4
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,10 @@
29002900
'language/expressions/assignmenttargettype/direct-callexpression-arguments': [FAIL],
29012901
'language/expressions/assignmenttargettype/parenthesized-callexpression-arguments': [FAIL],
29022902

2903+
# We replace U+202F (narrow-width space) with U+0020 (regular space).
2904+
# https://crbug.com/1414292
2905+
'intl402/DateTimeFormat/prototype/format/timedatestyle-en': [FAIL],
2906+
29032907
############################ INVALID TESTS #############################
29042908

29052909
# Test makes unjustified assumptions about the number of calls to SortCompare.

test/parallel/test-icu-env.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ if (isMockable) {
122122
assert.deepStrictEqual(
123123
locales.map((LANG) => runEnvOutside({ LANG, TZ: 'Europe/Zurich' }, 'new Date(333333333333).toLocaleString()')),
124124
[
125-
'7/25/1980, 1:35:33AM',
125+
'7/25/1980, 1:35:33 AM',
126126
'1980/7/25 01:35:33',
127127
'25/7/1980, 1:35:33 am',
128128
'25/7/1980, 1:35:33',

test/parallel/test-intl.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ if (!common.hasIntl) {
9797
// Test format
9898
{
9999
const localeString = date0.toLocaleString(['en'], optsGMT);
100-
if (Number(process.versions.cldr) >= 42) {
101-
assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
102-
} else {
103-
assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
104-
}
100+
assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
105101
}
106102
// number format
107103
{

0 commit comments

Comments
 (0)