-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Date parsing deviates from Chrome #11151
Comments
We've had to deal with WebKit Date parsing bugs in the past, this is likely just another one of those. Search the issue tracker for "date" to see more of these. |
No doubt. This exact case (ie "when year missing") doesn't seem to be addressed. |
Actually, |
Good to know! |
Assuming we can pull off the Qt 5.0 upgrade in a single release cycle (as Sincerely, On Tue, Mar 19, 2013 at 1:47 PM, Eugene Mirkin notifications@github.comwrote:
|
@zicjin: We love the enthusiasm but that alone won't help us get PhantomJS 2.0 out the door any faster. If you want to see it ready sooner, dive in and lend a hand! |
If it helps at all, I've found phantomjs spits out 'Invalid Date' when attempting to use a timeZone offset other than 'Z'. For example:
That will output 'Invalid Date', while this works just fine:
Doesn't help me solve the issue of my unit tests bombing in phantomjs when they shouldn't be, but figured I'd might as well share. |
Don't know if this will help you but I found this issue while researching another PhantomJS date parsing problem we were having. To fix ours I completed a polyfill that "successfully" overrides Date.parse and the Date contructor. I say "sucessfully" because of course, the constructor override is necessarily a hack. It solves our issue and I though you might be able to tweak to address yours. YMMV |
+1 Running into the same issue. new Date(120).toLocaleTimeString('en-US', {hour12: true}); expected: 4:00:00 PM |
@kevinparkerson's interim solution worked perfectly for me, thanks! |
thanks @kevinparkerson I thought I could do that, but you just confirmed it for me! |
Think I found another one. new Date("2034-03-25"); Expected |
@jdelibas Is the machine you're testing on in a timezone that's behind GMT? I get similar output in Chrome. It's implicitly adding "T00:00Z" – i.e. it's assuming GMT – and then returning the date in whatever timezone your environment thinks it is. I think that's expected, and not the same bug as here. What is the same bug is if you try to specify a timezone other than GMT in phantomjs> new Date("2034-03-25T00:00-0500")
"Invalid Date"
phantomjs> new Date("2034-03-25T00:00Z")
"2034-03-24T00:00:00.000Z" In Chrome: > new Date("2034-03-25T00:00-0500")
Sat Mar 25 2034 00:00:00 GMT-0500 (CDT)
> new Date("2034-03-25T00:00Z")
Fri Mar 24 2034 19:00:00 GMT-0500 (CDT) Note that Chrome displays the date in my local timezone, even though I created it using GMT. My rule of thumb is that any date without a timezone is inherently wrong or at the very least incomplete. That's why this bug is such a hassle, but at least converting everything to GMT is a valid, if tedious, workaround. |
Bug is already reported here: ariya/phantomjs#11151 Change-Id: I8039aa817fd2a8d5aae148cd9829f0c3143226bb
@jdelibas that one appears to be https://bugs.webkit.org/show_bug.cgi?id=130123. Able to reproduce in Phantom 2. |
PhantomJS 2.1.1 still has the WebKit bug referred to by @jnu. It was fixed in WebKit on 2014-03-14. Parsed dates from 2034-03-01 to 2100-02-28 are wrong.
|
We are still seeing date inconsistencies with Chrome for the following values (the local timezone is -0700):
Chrome parses those as:
|
I'm glad I found this thread. I've been trying to render a page with charts on it, and you can imagine how many Date objects get used. Nothing was working, I thought I was going crazy until I ran: phantom> new Date('2017-01-13 01:14')
Invalid Date WAT? |
We're using the beta Phantom 2.5 build and dates are still fucked up so the Qt update did nothing to fix any of that. Trying to compare dates (somedate < currdate) to see which one is in the past works 1 out of 5 runs... We're running jasmine on top of Phantom so our tests are becoming flaky due to this issue. Any progress or updates? |
Running BackstopJS (which is using PhantomJS to work) and I encountered this error as well and I can't take diff screenshots of certain pages anymore. Any updates? |
This is due to ariya/phantomjs#11151 which makes those tests unusable
Consider this the semi annual, "it is still broken and some feedback would be amazing" comment. |
@ktiedt try headless Chrome/Firefox instead. I believe the addition of that flag to those browsers has rendered this project obsolete. https://developers.google.com/web/updates/2017/04/headless-chrome |
@wallw-bits yeah after posting, I learned that Phantom is no more, thanks for the links, those I had not come across yet. |
Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution! |
Best shown by example:
In Chrome, both strings are parsed into the same date. Thoughts?
The text was updated successfully, but these errors were encountered: