[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

With Hermes engine, certain date formats crash on production but works in debug #26187

Closed
roydipti23 opened this issue Aug 26, 2019 · 8 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@roydipti23
Copy link
roydipti23 commented Aug 26, 2019

React Native version: RN60

new Date('Jul 18, 2018') is not supported on RN
new Date('18-07-2018 12:00') is not supported on RN

Steps To Reproduce

  1. add date: const reproduce = new Date('Jul 18, 2018');
  2. It will crash in production

Describe what you expected to happen:
It should return the expected date.

Snack, code example, screenshot, or link to a repository:

export function getDateFormat(date = 'Jul 18, 2018' ) {
const newDate = new Date(date);
return newDate;
}

export function getDateFormat(date = '18-07-2018 12:00' ) {
const newDate = new Date(date);
return newDate;
}

@roydipti23 roydipti23 added the Bug label Aug 26, 2019
@roydipti23 roydipti23 changed the title RN60 certain date formats crash on production but works in debug With Hermes engine certain date formats crash on production but works in debug Aug 26, 2019
@roydipti23 roydipti23 changed the title With Hermes engine certain date formats crash on production but works in debug With Hermes engine, certain date formats crash on production but works in debug Aug 26, 2019
@radko93
Copy link
Contributor
radko93 commented Aug 26, 2019

Are you testing on debug without remote debugging enabled? Because then you are using Chrome to run JS code.

@roydipti23
Copy link
Author

@radko93 debug JS remotely is enabled. And this same format was working previously in production before Hermes.

export function getDateFormat(date = 'Jul 18, 2018' ) {
const newDate = new Date(date);
return newDate;
}

@henrymoulton
Copy link
Contributor

I'd recommend looking at using Moment.js. JavaScript engines differ in how they treat Date objects: https://www.freecodecamp.org/news/get-to-know-different-javascript-environments-in-react-native-4951c15d61f5/

@radko93
Copy link
Contributor
radko93 commented Aug 27, 2019

@roydipti23 Chrome treats dates differently than Hermes. If you want to test in debug mode turn off remote Chrome debugging.

@HarshitMadhav
Copy link

@roydipti23 try using moment js for the same

@jmeistrich
Copy link

I'm seeing this also. A date in ISO format like Fri, 06 Sep 2019 18:45:29 +0000 (UTC) parses as an Invalid Date in Hermes. It works on iOS and was working in Android in 0.59. I am now using Moment as a workaround but this should be supported natively.

@stale
Copy link
stale bot commented Dec 7, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 7, 2019
@stale
Copy link
stale bot commented Dec 14, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Dec 14, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Dec 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

5 participants