WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
187519
Date constructor with negative value argument
https://bugs.webkit.org/show_bug.cgi?id=187519
Summary
Date constructor with negative value argument
gfablima
Reported
2018-07-10 08:38:46 PDT
Hi everyone, I found an inconsistence on Date() with a negative value. I was looking on ES6 specification about this issue but I didn't found an answer, maybe the correct way is convert the -0 to +0 as V8 and SpiderMonkey do. Steps to reproduce: ``` d = new Date(-0); print(Object.is(d.getTime(), +0)) ``` Actual results: false Expected results: true V8 and SpiderMonkey works as expected. OS: Ubuntu 16.04 x64 Version: 606.1.9.4
Attachments
Add attachment
proposed patch, testcase, etc.
isol2
Comment 1
2018-07-12 11:33:00 PDT
Daily build v233772 not reproduce this issue
Alexey Shvayka
Comment 2
2020-05-20 14:47:22 PDT
(In reply to isol2 from
comment #1
)
> Daily build v233772 not reproduce this issue
r261927
doesn't reproduce this either. (In reply to gfablima from
comment #0
)
> I was looking on ES6 specification about this issue but I didn't found an > answer, maybe the correct way is convert the -0 to +0 > as V8 and SpiderMonkey do.
Date constructor (
https://tc39.es/ecma262/#sec-date-value
) performs TimeClip at step 4.d, which uses ToInteger (
https://tc39.es/ecma262/#sec-tointeger
) to normalize -0 to 0 (step 2). This is covered by:
https://test262.report/browse/built-ins/Date/TimeClip_negative_zero.js
https://test262.report/browse/built-ins/Date/prototype/getTime/this-value-valid-date.js
https://test262.report/browse/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js
(all passed by JSC)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug