Bug 220687 - Date.parse returns non-integral time value
Summary: Date.parse returns non-integral time value
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Mac (Intel) macOS 10.15
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-17 06:45 PST by Mike Fikes
Modified: 2021-01-31 12:48 PST (History)
10 users (show)

See Also:


Attachments
Patch (7.13 KB, patch)
2021-01-31 02:03 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (8.13 KB, patch)
2021-01-31 02:49 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].