[webkit-changes] [WebKit/WebKit] a8f967: [JSC] Date parse should accept narrow-no-break-space

Yusuke Suzuki noreply at github.com
Wed Nov 16 14:50:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a8f967cd42c5add143939660b7cd928375182377
      https://github.com/WebKit/WebKit/commit/a8f967cd42c5add143939660b7cd928375182377
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-11-16 (Wed, 16 Nov 2022)

  Changed paths:
    M JSTests/complex.yaml
    A JSTests/complex/date-parse-with-narrow-no-break-space.js
    M Source/JavaScriptCore/runtime/JSDateMath.cpp
    M Source/WTF/wtf/unicode/CharacterNames.h

  Log Message:
  -----------
  [JSC] Date parse should accept narrow-no-break-space
https://bugs.webkit.org/show_bug.cgi?id=247986
rdar://102427399

Reviewed by Alexey Shvayka.

After ICU 72, CLDR generates narrow-no-break-space for date time output. So, `new Date().toLocaleString('en-US')` starts generating
a string including narrow-no-break-space instead of simple spaces. However since code in the wild assumes `new Date(new Date().toLocaleString('en-US'))`
works, we need to maintain the ability to parse string including narrowNoBreakSpaces. Rough consensus among implementaters (V8, SpiderMonkey, and us)
is replacing narrowNoBreakSpaces with simple spaces before parsing.

* JSTests/complex.yaml:
* JSTests/complex/date-parse-with-narrow-no-break-space.js: Added.
(shouldBe):
* Source/JavaScriptCore/runtime/JSDateMath.cpp:
(JSC::DateCache::parseDate):
* Source/WTF/wtf/unicode/CharacterNames.h:

Canonical link: https://commits.webkit.org/256754@main




More information about the webkit-changes mailing list