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
Technically the spec doesn鈥檛 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.
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.
This particular pattern was added in 013566a05d8dc7a38e7628a6923173896e7edeb8 (thanks @Huxpro).
It will be available in the next release of Hermes.
Please to comment in https://github.com/facebook/hermes/issues/243 if this should be included in the next patch release.
Most helpful comment
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.