Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date parse issue #219

Closed
gaodeng opened this issue Apr 17, 2020 · 4 comments
Closed

Date parse issue #219

gaodeng opened this issue Apr 17, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@gaodeng
Copy link

gaodeng commented Apr 17, 2020

hermes

(new Date("Friday, 17 Apr 2020 07:10:00 +0800")).valueOf();
NaN

chrome / safari / firefox

(new Date("Friday, 17 Apr 2020 07:10:00 +0800")).valueOf();
1587078600000
@ljharb
Copy link

ljharb commented Apr 17, 2020

Technically the spec doesn’t mandate this; however, anything the majority of browsers do is defacto web reality (regardless of which edition one is targeting), so any engine would be wasting effort not to match it.

@avp
Copy link
Contributor

avp commented Apr 17, 2020

It seems like many engines simply ignore any words up to the first space before the date starts, meaning that the "day of the week"can be any string and does not have to actually be a valid day of the week.

We'll look into adding support for that behavior.

Until we do, you can work around this by cutting the first word out of the string before passing it to Date.

@avp avp added the enhancement New feature or request label Apr 17, 2020
@avp
Copy link
Contributor

avp commented May 13, 2020

This particular pattern was added in 013566a (thanks @Huxpro).

It will be available in the next release of Hermes.

@avp avp closed this as completed May 13, 2020
@tmikov
Copy link
Contributor

tmikov commented May 14, 2020

Please to comment in #243 if this should be included in the next patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants