WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
185868
Date.parse() doesn't properly handle input outside of ES Spec limits
https://bugs.webkit.org/show_bug.cgi?id=185868
Summary
Date.parse() doesn't properly handle input outside of ES Spec limits
Michael Saboff
Reported
2018-05-22 07:50:36 PDT
From May 2018 TC-39 meeting: SpiderMonkey strictly conforms to the Time Value specification:
> Date.parse("-271821-04-19T11:59:59.999Z")
NaN V8, JSC:
> Date.parse("-271821-04-19T11:59:59.999Z")
-8640000043200001
> Date.parse("-999999-01-01T00:00:00.000Z")
V8/JSC -31619087596800000
> Date.parse("-999999-01-01T00:00:00.001Z")
V8/JSC -31619087596800000
> Date.parse("-999999-01-01T00:00:00.002Z")
V8 -31619087596800000 JSC -31619087596799996
> Date.parse("-1000000-01-01T00:00:00.000Z")
V8 NaN
> Date.parse("-1000000-01-01T00:00:00.000Z")
JSC -31619119219200000 Apparently the Safari implementation is accepting any year value from MIN_INT to MAX_INT - 1:
> Date.parse("-2147483648-01-01T00:00:00.000Z")
NaN
> Date.parse("-2147483647-01-01T00:00:00.000Z")
-67768100536348800000 ...
> Date.parse("2147483646-01-01T00:00:00.000Z")
67767976170460800000
> Date.parse("2147483647-01-01T00:00:00.000Z")
NaN Test262 tests will land soon.
Attachments
Patch
(7.29 KB, patch)
2018-05-23 12:00 PDT
,
Michael Saboff
mark.lam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Michael Saboff
Comment 1
2018-05-23 12:00:17 PDT
Created
attachment 341111
[details]
Patch
Mark Lam
Comment 2
2018-05-23 12:07:02 PDT
Comment on
attachment 341111
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=341111&action=review
r=me
> Source/WTF/wtf/DateMath.cpp:562 > + // Clamp to EcmaScript standard of +/- 100,000,000 days from 01 January, 1970.
Let's add a link to
https://tc39.github.io/ecma262/#sec-time-values-and-time-range
here.
Michael Saboff
Comment 3
2018-05-23 13:02:41 PDT
Committed
r232122
: <
https://trac.webkit.org/changeset/232122
>
Radar WebKit Bug Importer
Comment 4
2018-05-23 13:03:33 PDT
<
rdar://problem/40495678
>
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