Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 82a3a3991176fb5224c11618257260f4f68358e1
https://github.com/WebKit/WebKit/commit/82a3a3991176fb5224c11618257260f4f68358e1
Author: Keita Nonaka <[email protected]>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
A JSTests/stress/date-parse-with-hyphen.js
M Source/WTF/wtf/DateMath.cpp
Log Message:
-----------
non standard new Date('2024-12-3') yields to Invalid Date
https://bugs.webkit.org/show_bug.cgi?id=283825
Reviewed by Yusuke Suzuki.
Date constructor and Date.parse() in WebKit previously produced
the following results:
new Date('2024-12-3') // -> Invalid Date
Date.parse('2024-12-3') // -> NaN
This occurred because the hyphenated format does not conform to
the TC39 spec date format [1].
As a result, Each browser falls back to any implementation-specific heuristics
or
implementation-specific date formats [2].
However, the WebKit's behavior is different from that of Chrome and FireFox,
introducing inconsistencies and additional complexity in web development [3][4].
This patch fixes the date parsing behavior for hyphenated date strings
to align with Chrome and Firefox.
[1]: https://tc39.es/ecma262/#sec-date-time-string-format
[2]: https://tc39.es/ecma262/#sec-date.parse
[3]: https://stackoverflow.com/questions/4310953/invalid-date-in-safari
[4]:
https://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format
* JSTests/stress/date-parse-with-hyphen.js: Added.
(shouldBe):
(validateDate):
* Source/WTF/wtf/DateMath.cpp:
(WTF::parseES5Date):
Canonical link: https://commits.webkit.org/299182@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes