Skip to content

Commit c786ed3

Browse files
committed
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 <adamk@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#85757} Refs: v8/v8@90be99f PR-URL: #46646 Refs: #46123 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent a38de61 commit c786ed3

File tree

7 files changed

+32
-7
lines changed

7 files changed

+32
-7
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
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.11',
39+
'v8_embedder_string': '-node.12',
4040

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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,11 @@ MaybeHandle<String> FormatDateTime(Isolate* isolate,
13951395
icu::UnicodeString result;
13961396
date_format.format(date_value, result);
13971397

1398+
// Revert ICU 72 change that introduced U+202F instead of U+0020
1399+
// to separate time from AM/PM. See https://crbug.com/1414292.
1400+
result = result.findAndReplace(icu::UnicodeString(0x202f),
1401+
icu::UnicodeString(0x20));
1402+
13981403
return Intl::ToString(isolate, result);
13991404
}
14001405

deps/v8/test/mjsunit/mjsunit.status

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@
464464

465465
# Non-BMP characters currently aren't considered identifiers in no_i18n
466466
'harmony/private-name-surrogate-pair': [PASS,FAIL],
467+
468+
# Tests ICU-specific behavior.
469+
'regress/regress-crbug-1414292': [SKIP],
467470
}], # 'no_i18n'
468471

469472
##############################################################################
Lines changed: 17 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@
669669
'language/expressions/assignmenttargettype/direct-callexpression-arguments': [FAIL],
670670
'language/expressions/assignmenttargettype/parenthesized-callexpression-arguments': [FAIL],
671671

672+
# We replace U+202F (narrow-width space) with U+0020 (regular space).
673+
# https://crbug.com/1414292
674+
'intl402/DateTimeFormat/prototype/format/timedatestyle-en': [FAIL],
675+
672676
############################ INVALID TESTS #############################
673677

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

test/parallel/test-icu-env.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 5 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy