Bug 220687

Summary: Date.parse returns non-integral time value
Product: WebKit Reporter: Mike Fikes <mike>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, fpizlo, mark.lam, msaboff, ross.kirsling, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Intel)   
OS: macOS 10.15   
Attachments:
Description Flags
Patch
none
Patch none

Description Mike Fikes 2021-01-17 06:45:43 PST
Date.parse should return either an integer or NaN.

Here is an example where it returns a floating point number near an integer, but is not an integer:

>>> Date.parse("2514-06-01T00:00:00.148Z")
17180035200147.998

This was produced using the jsc binary included in: Safari Technology Preview Release 118 (Safari 14.1, WebKit 15611.1.9.3.1)
Comment 1 Radar WebKit Bug Importer 2021-01-20 01:50:18 PST
<rdar://problem/73395718>
Comment 2 Yusuke Suzuki 2021-01-31 02:03:45 PST
Created attachment 418822 [details]
Patch
Comment 3 Yusuke Suzuki 2021-01-31 02:49:18 PST
Created attachment 418823 [details]
Patch
Comment 4 Ross Kirsling 2021-01-31 11:51:00 PST
Comment on attachment 418823 [details]
Patch

r=me.

I guess you could say there's some minor confusion potential due to using `milliseconds` to mean both "an entire timestamp in ms" and "the fractional part of the current time in ms", but I don't know if I have a suggestion, and hopefully it's still clear enough by having "seconds" and "milliseconds" be adjacent parameters.
Comment 5 Yusuke Suzuki 2021-01-31 12:31:26 PST
Comment on attachment 418823 [details]
Patch

Thanks!
Comment 6 EWS 2021-01-31 12:48:07 PST
Committed r272127: <https://trac.webkit.org/changeset/272127>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418823 [details].