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

[firestore] Invalid Date on some Android devices #545

Closed
chrisbianca opened this issue Oct 23, 2017 · 7 comments
Closed

[firestore] Invalid Date on some Android devices #545

chrisbianca opened this issue Oct 23, 2017 · 7 comments
Assignees
Labels

Comments

@chrisbianca
Copy link
Contributor

Following on from: #533 (comment) courtesy of @urajat:

Just got around to testing this. 3.0.5 works on the emulator (tested on Android 7.1.1). But on the device with 7.1.1, this doesn't work - I get an Invalid Date value for the dates which are being read even though they work perfectly on the emulator and are correct on Firestore too. I added debugging statements in buildTypeMap to compare the values on device vs emulator - there is no change and the parsing is working as expected. I even tried going back to 3.0.4 and manually making the 'X' to 'Z' change to see if that helps, but nope - same Invalid Date issue on device. In the morning, I was testing with a 6.0.1 device where the Z option worked. Not sure if there's some other place where there is some date interpretation happening.

@chrisbianca
Copy link
Contributor Author

@urajat Can I start by saying that I hate working with Dates, in any programming language, let alone when you've got to convert between 3 different ones! You'd think that after 40 years of software development (give or take) that somebody would have got them working properly...

This sounds like a Javascript parsing issue. A quick search on RN shows that there are a few historical issues which indicate that apparently, if debug mode is enabled then date handling is done differently?!

facebook/react-native#13195

Do you have debug mode enabled?

@chrisbianca
Copy link
Contributor Author

@urajat Just to confirm - with debug mode enabled, everything works fine. With debug mode disabled, it doesn't work. I'm going to look at using ms rather than the ISO string and see if that works any better

@urajat
Copy link
Contributor

urajat commented Oct 24, 2017

@chrisbianca +1 on the dates bit. I remember putting in a fix in Django 10 years ago for a timezone-related issue :-(

I tried out the debug mode enabling/disabling part and can see that the issue is indeed there. With both emulator and device, with debug mode disabled, I get the Invalid Date error.

@chrisbianca
Copy link
Contributor Author

@urajat Ok, I've just pushed up a fix - hopefully the last one! Are you able to test with the latest code? You can install using:

npm install --save https://github.com/invertase/react-native-firebase#v3.0.x

@urajat
Copy link
Contributor

urajat commented Oct 24, 2017

@chrisbianca Yes, this seems to work on both device and emulator in debug/non-debug modes on Android :-)

@chrisbianca
Copy link
Contributor Author

Whoop, we got their eventually! Thanks for all your help - I'll get a release out either today or tomorrow with this change in

@urajat
Copy link
Contributor

urajat commented Oct 24, 2017

Great! Thanks for the quick turnaround on this.

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

No branches or pull requests

2 participants