Condition Fails In React Native Production, But Works In Development
I have created a react native app, by which I need compare from and to date. And if it's true, execution will be done. The problem is, the condition works in react native developme
Solution 1:
Actually this, happens because of different javascript core. As , chrome has latest version of core, but react native doesnt. So you need to give date as per ES6, change the date "01-02-2019" to
"Fri Feb 02 2018 00:00:00 GMT+0530 (India Standard Time)".
And after that, remove
.split("-").reverse(); on both dates.
Hope Fully it will work.
Solution 2:
Once I come across the same issue with date. Then I have tried to enclose the value with new Date()
and that helped me. I thought your problem is also similar to that. Try to compare as
if((new Date(d) >= new Date(k)) && (new Date(d) <= new Date(j))){
...some code
}
Post a Comment for "Condition Fails In React Native Production, But Works In Development"