summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2023-02-20 13:10:28 +0100
committerJuan José Arboleda <soyjuanarbol@gmail.com>2023-03-04 23:03:34 -0500
commit492fc95bdfc3699d47c4edf04d4952923c2ca2c1 (patch)
treedf7b565c687ffee1e760a32956aaf0190c2155f3
parent73a8f46c4dd993d722b1cb8ab4c8a2053c833af7 (diff)
downloadnode-new-492fc95bdfc3699d47c4edf04d4952923c2ca2c1.tar.gz
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: https://github.com/v8/v8/commit/90be99fab31c8299568e4114be1f0abd3741d615 PR-URL: https://github.com/nodejs/node/pull/46646 Refs: https://github.com/nodejs/node/issues/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>
-rw-r--r--common.gypi2
-rw-r--r--deps/v8/src/objects/js-date-time-format.cc5
-rw-r--r--deps/v8/test/mjsunit/mjsunit.status3
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-1414292.js17
-rw-r--r--deps/v8/test/test262/test262.status4
-rw-r--r--test/parallel/test-icu-env.js2
-rw-r--r--test/parallel/test-intl.js6
7 files changed, 32 insertions, 7 deletions
diff --git a/common.gypi b/common.gypi
index e463e175f9..782c871cff 100644
--- a/common.gypi
+++ b/common.gypi
@@ -36,7 +36,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.24',
+ 'v8_embedder_string': '-node.25',
##### V8 defaults for Node.js #####
diff --git a/deps/v8/src/objects/js-date-time-format.cc b/deps/v8/src/objects/js-date-time-format.cc
index 955370b7ba..d2e3efb9f4 100644
--- a/deps/v8/src/objects/js-date-time-format.cc
+++ b/deps/v8/src/objects/js-date-time-format.cc
@@ -753,6 +753,11 @@ MaybeHandle<String> FormatDateTime(Isolate* isolate,
icu::UnicodeString result;
date_format.format(date_value, result);
+ // Revert ICU 72 change that introduced U+202F instead of U+0020
+ // to separate time from AM/PM. See https://crbug.com/1414292.
+ result = result.findAndReplace(icu::UnicodeString(0x202f),
+ icu::UnicodeString(0x20));
+
return Intl::ToString(isolate, result);
}
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status
index d6fcf9b676..78677186dc 100644
--- a/deps/v8/test/mjsunit/mjsunit.status
+++ b/deps/v8/test/mjsunit/mjsunit.status
@@ -511,6 +511,9 @@
# Non-BMP characters currently aren't considered identifiers in no_i18n
'harmony/private-name-surrogate-pair': [PASS,FAIL],
+
+ # Tests ICU-specific behavior.
+ 'regress/regress-crbug-1414292': [SKIP],
}], # 'no_i18n'
##############################################################################
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1414292.js b/deps/v8/test/mjsunit/regress/regress-crbug-1414292.js
new file mode 100644
index 0000000000..3a0831c67f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-1414292.js
@@ -0,0 +1,17 @@
+// Copyright 2023 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const date = new Date("Wed Feb 15 2023 00:00:00 GMT+0100");
+const localeString = date.toLocaleString("en-US");
+// No narrow-width space should be found
+assertEquals(-1, localeString.search('\u202f'));
+// Regular space should match the character between time and AM/PM.
+assertMatches(/:\d\d:\d\d [AP]M$/, localeString);
+
+const formatter = new Intl.DateTimeFormat('en', {timeStyle: "long"})
+const formattedString = formatter.format(date)
+// No narrow-width space should be found
+assertEquals(-1, formattedString.search('\u202f'));
+// Regular space should match the character between time and AM/PM.
+assertMatches(/:\d\d:\d\d [AP]M$/, localeString);
diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status
index ea1ccefb5f..da91da8842 100644
--- a/deps/v8/test/test262/test262.status
+++ b/deps/v8/test/test262/test262.status
@@ -2900,6 +2900,10 @@
'language/expressions/assignmenttargettype/direct-callexpression-arguments': [FAIL],
'language/expressions/assignmenttargettype/parenthesized-callexpression-arguments': [FAIL],
+ # We replace U+202F (narrow-width space) with U+0020 (regular space).
+ # https://crbug.com/1414292
+ 'intl402/DateTimeFormat/prototype/format/timedatestyle-en': [FAIL],
+
############################ INVALID TESTS #############################
# Test makes unjustified assumptions about the number of calls to SortCompare.
diff --git a/test/parallel/test-icu-env.js b/test/parallel/test-icu-env.js
index 9db276e5bb..45b9fea8db 100644
--- a/test/parallel/test-icu-env.js
+++ b/test/parallel/test-icu-env.js
@@ -122,7 +122,7 @@ if (isMockable) {
assert.deepStrictEqual(
locales.map((LANG) => runEnvOutside({ LANG, TZ: 'Europe/Zurich' }, 'new Date(333333333333).toLocaleString()')),
[
- '7/25/1980, 1:35:33 AM',
+ '7/25/1980, 1:35:33 AM',
'1980/7/25 01:35:33',
'25/7/1980, 1:35:33 am',
'25/7/1980, 1:35:33',
diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js
index 2cf3efe11a..7d1742f2c7 100644
--- a/test/parallel/test-intl.js
+++ b/test/parallel/test-intl.js
@@ -97,11 +97,7 @@ if (!common.hasIntl) {
// Test format
{
const localeString = date0.toLocaleString(['en'], optsGMT);
- if (Number(process.versions.cldr) >= 42) {
- assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
- } else {
- assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
- }
+ assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
}
// number format
{