Bug 199964

Summary: DateConversion::formatDateTime incorrectly formats negative years
Product: WebKit Reporter: Alexey Shvayka <ashvayka>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: commit-queue, ews-watchlist, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Alexey Shvayka
Reported 2019-07-19 15:17:16 PDT
Test case: d = new Date; d.setFullYear(-12); d.toUTCString().split(" ")[3] Expected: "-0012" Math.abs(year) should be padded to length of 4 and preceded with "-" if year < 0. Actual: "-012" JSC always pads year to length of 4, including minus sign "-". Other browsers engines comply with the spec. ECMA262: https://tc39.es/ecma262/#sec-datestring (steps 6-10) Test262: https://test262.report/browse/built-ins/Date/prototype/toDateString/negative-year.js https://test262.report/browse/built-ins/Date/prototype/toString/negative-year.js https://test262.report/browse/built-ins/Date/prototype/toUTCString/invalid-date.js
Attachments
Patch (4.43 KB, patch)
2019-07-19 15:33 PDT, Alexey Shvayka
no flags
Alexey Shvayka
Comment 1 2019-07-19 15:33:02 PDT
WebKit Commit Bot
Comment 2 2019-08-15 12:31:20 PDT
Comment on attachment 374510 [details] Patch Clearing flags on attachment: 374510 Committed r248738: <https://trac.webkit.org/changeset/248738>
WebKit Commit Bot
Comment 3 2019-08-15 12:31:21 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 4 2019-08-15 12:32:16 PDT
Note You need to log in before you can comment on or make changes to this bug.