Open
Bug 1858595
Opened 1 year ago
Updated 1 year ago
Date.parse parses the time "01::01" as 01:01:00
Categories
(Core :: JavaScript: Standard Library, defect, P3)
Core
JavaScript: Standard Library
Tracking
()
NEW
People
(Reporter: vinny.diehl, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome)
Discovered this parity bug while working on bug 1557650. V8 parses this oddball time format as 01:00:01, while SpiderMonkey parses it as 01:01:00.
> eshost -te 'new Date("Mar 01 1991 01::01").toString()'
Engine | Result |
---|---|
JavaScriptCore | Invalid Date |
SpiderMonkey | Fri Mar 01 1991 01:01:00 GMT-0700 (Mountain Standard Time) |
V8 | Fri Mar 01 1991 01:00:01 GMT-0700 (Mountain Standard Time) |
Comment 1•1 year ago
•
|
||
We'll set a priority of P3 based on the parent issue 1557650
Priority: -- → P3
Reporter | ||
Comment 2•1 year ago
•
|
||
Looking into this deeper has revealed more quirks about how Chrome handles colons:
Input | JavaScriptCore | SpiderMonkey | V8 |
---|---|---|---|
"05:Mar:2015" |
Invalid Date | Invalid Date | Sun Mar 01 2015 05:00:00 GMT-0700 (Mountain Standard Time) |
"05:02:03:Mar:2015" |
Invalid Date | Invalid Date | Sun Mar 01 2015 05:02:03 GMT-0700 (Mountain Standard Time) |
"05:02:03:04:Mar:2015" |
Invalid Date | Invalid Date | Sun Mar 01 2015 05:02:03 GMT-0700 (Mountain Standard Time) |
"Mar:05:02:03:04:2015" |
Invalid Date | Invalid Date | Sun Mar 01 2015 05:02:03 GMT-0700 (Mountain Standard Time) |
"05:02:03:Mar:06:2015" |
Invalid Date | Invalid Date | Sun Mar 01 2015 05:02:03 GMT-0700 (Mountain Standard Time) |
"Mar:05:02:03:04:06 2015" |
Invalid Date | Invalid Date | Fri Mar 06 2015 05:02:03 GMT-0700 (Mountain Standard Time) |
"Mar:05:02:03:04: 06:2015" |
Invalid Date | Invalid Date | Invalid Date |
What I make of this:
- Colons are legal anywhere in the date, but cannot be between the mday and year or mday will not be parsed
- The time can be anywhere in the date string
- A colon after a number will initiate the parsing of a time, until a non-number is reached
- Numbers after the seconds have been parsed are ignored
Not all of this behavior will necessarily be copied in this bug, but as the colon parsing will need to be reworked here, this is worth noting.
You need to log in
before you can comment on or make changes to this bug.
Description
•