-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Comments
Are you testing on debug without remote debugging enabled? Because then you are using Chrome to run JS code. |
@radko93 debug JS remotely is enabled. And this same format was working previously in production before Hermes. export function getDateFormat(date = 'Jul 18, 2018' ) { |
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/ |
@roydipti23 Chrome treats dates differently than Hermes. If you want to test in debug mode turn off remote Chrome debugging. |
@roydipti23 try using moment js for the same |
I'm seeing this also. A date in ISO format like |
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. |
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. |
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
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;
}
The text was updated successfully, but these errors were encountered: