GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: cherry-pick 2ada52cffbff · nodejs/node@f63ae52

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8
    • src/date
      • dateparser-inl.h
      • dateparser.h
    • test/intl
      • regress-13494.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines 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.7',
39+
'v8_embedder_string': '-node.8',
4040

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

Collapse file

‎deps/v8/src/date/dateparser-inl.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/date/dateparser-inl.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ DateParser::DateToken DateParser::DateStringTokenizer<CharType>::Scan() {
192192
if (in_->Skip('+')) return DateToken::Symbol('+');
193193
if (in_->Skip('.')) return DateToken::Symbol('.');
194194
if (in_->Skip(')')) return DateToken::Symbol(')');
195-
if (in_->IsAsciiAlphaOrAbove()) {
195+
if (in_->IsAsciiAlphaOrAbove() && !in_->IsWhiteSpaceChar()) {
196196
DCHECK_EQ(KeywordTable::kPrefixLength, 3);
197197
uint32_t buffer[3] = {0, 0, 0};
198198
int length = in_->ReadWord(buffer, 3);
Collapse file

‎deps/v8/src/date/dateparser.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/date/dateparser.h
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ class DateParser : public AllStatic {
9191
// Return word length.
9292
int ReadWord(uint32_t* prefix, int prefix_size) {
9393
int len;
94-
for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) {
94+
for (len = 0; IsAsciiAlphaOrAbove() && !IsWhiteSpaceChar();
95+
Next(), len++) {
9596
if (len < prefix_size) prefix[len] = AsciiAlphaToLower(ch_);
9697
}
9798
for (int i = len; i < prefix_size; i++) prefix[i] = 0;
@@ -115,6 +116,7 @@ class DateParser : public AllStatic {
115116
bool IsEnd() const { return ch_ == 0; }
116117
bool IsAsciiDigit() const { return IsDecimalDigit(ch_); }
117118
bool IsAsciiAlphaOrAbove() const { return ch_ >= 'A'; }
119+
bool IsWhiteSpaceChar() const { return IsWhiteSpace(ch_); }
118120
bool IsAsciiSign() const { return ch_ == '+' || ch_ == '-'; }
119121

120122
// Return 1 for '+' and -1 for '-'.
Collapse file

‎deps/v8/test/intl/regress-13494.js‎

Copy file name to clipboard
+47Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2022 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+
// Test the new Date( date.toLocaleString("en-US")) is not invalid.
6+
// This is not guaranteed by the standard but many code use that to set the
7+
// timezone as suggested in
8+
// https://stackoverflow.com/questions/15141762/how-to-initialize-a-javascript-date-to-a-particular-time-zone
9+
10+
let d = new Date();
11+
12+
// https://tc39.es/ecma262/#sec-todatestring
13+
// 21.4.4.41.4 ToDateString ( tv )
14+
// 1. If tv is NaN, return "Invalid Date".
15+
let invalid = "Invalid Date";
16+
let largestDiff = 25*60*60*1000;
17+
18+
let garbage = new Date("garbage");
19+
assertTrue(invalid == garbage);
20+
assertEquals(NaN, garbage.getTime());
21+
22+
let d1 = new Date(d.toLocaleString("en-US"));
23+
assertTrue(d1 != invalid);
24+
assertTrue(d1.getTime() != NaN);
25+
// The milliseconds are different between d1 and d.
26+
assertTrue(Math.abs(d1-d) < 1000);
27+
28+
// Force a version of date string which have U+202f before AM
29+
let nnbsp_am = new Date("11/16/2022, 9:04:55\u202fAM");
30+
assertTrue(nnbsp_am != invalid);
31+
assertTrue(nnbsp_am.getTime() != NaN);
32+
// Force a version of date string which have U+202f before PM
33+
let nnbsp_pm = new Date("11/16/2022, 9:04:55\u202fPM");
34+
assertTrue(nnbsp_pm != invalid);
35+
assertTrue(nnbsp_pm.getTime() != NaN);
36+
37+
let d2 = new Date(d.toLocaleString("en-US", {timeZone: "Asia/Taipei"}));
38+
assertTrue(d2 != invalid);
39+
assertTrue(d2.getTime() != NaN);
40+
// The differences should be within 25 hours.
41+
assertTrue(Math.abs(d2-d) < largestDiff);
42+
43+
let d3 = new Date(d.toLocaleString("en-US", {timeZone: "Africa/Lusaka"}));
44+
assertTrue(d3 != invalid);
45+
assertTrue(d3.getTime() != NaN);
46+
// The differences should be within 25 hours.
47+
assertTrue(Math.abs(d3-d) < largestDiff);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.