From 501a90aad3aa33a353599c18fb2d4a985894b798 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 5 Mar 2026 17:32:10 -0800 Subject: [PATCH] Support Unicode White Spaces in ParseDate() --- js/src/jsdate.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index dfd04e1305..e29d6c6b24 100755 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -36,6 +36,7 @@ #include "js/Conversions.h" #include "js/Date.h" +#include "unicode/uchar.h" #include "vm/DateTime.h" #include "vm/GlobalObject.h" #include "vm/Interpreter.h" @@ -961,7 +962,13 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result) while (i < length) { int c = s[i]; i++; - + + // CLDR 42 has opened the door to whitespace, + // so let's normalize them all to standard spaces. + if (u_hasBinaryProperty(static_cast(c), UCHAR_WHITE_SPACE)) { + c = ' '; + } + // Spaces, ASCII control characters, and commas are ignored. if (c <= ' ' || c == ',') continue; @@ -998,6 +1005,11 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result) i++; } + // CLDR 42 reprise. + if (u_hasBinaryProperty(static_cast(c), UCHAR_WHITE_SPACE)) { + c = ' '; + } + /* * Allow TZA before the year, so 'Wed Nov 05 21:49:11 GMT-0800 1997' * works.