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

java.util.Date changes #6

Closed
roranmorea opened this issue Jun 13, 2019 · 1 comment
Closed

java.util.Date changes #6

roranmorea opened this issue Jun 13, 2019 · 1 comment
Labels
question Further information is requested

Comments

@roranmorea
Copy link
Collaborator

(0.6.6-dev) [Firestore]: The behavior for java.util.Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
W/Firestore( 771): To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:
W/Firestore( 771):
W/Firestore( 771): FirebaseFirestore firestore = FirebaseFirestore.getInstance();
W/Firestore( 771): FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
W/Firestore( 771): .setTimestampsInSnapshotsEnabled(true)
W/Firestore( 771): .build();
W/Firestore( 771): firestore.setFirestoreSettings(settings);
W/Firestore( 771):
W/Firestore( 771): With this change, timestamps stored in Cloud Firestore will be read back as com.google.firebase.Timestamp objects instead of as system java.util.Date objects. So you will also need to update code expecting a java.util.Date to instead expect a Timestamp. For example:
W/Firestore( 771):
W/Firestore( 771): // Old:
W/Firestore( 771): java.util.Date date = snapshot.getDate("created_at");
W/Firestore( 771): // New:
W/Firestore( 771): Timestamp timestamp = snapshot.getTimestamp("created_at");
W/Firestore( 771): java.util.Date date = timestamp.toDate();
W/Firestore( 771):
W/Firestore( 771): Please audit all existing usages of java.util.Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.

@roranmorea roranmorea added the question Further information is requested label Jun 13, 2019
@pythonpoet
Copy link
Owner

Wird von uns wahrscheinlich nicht benutzt.

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

No branches or pull requests

2 participants