[Webkit-unassigned] [Bug 199964] New: DateConversion::formatDateTime incorrectly formats negative years

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 19 15:17:16 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=199964

            Bug ID: 199964
           Summary: DateConversion::formatDateTime incorrectly formats
                    negative years
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Minor
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: shvaikalesh at gmail.com

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190719/775b19c5/attachment.html>


More information about the webkit-unassigned mailing list