-
Notifications
You must be signed in to change notification settings - Fork 22
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
Added fix to prevent error for Firestore v5.5.0 #32
Conversation
This message shows up now... added the fix as described. ``` @firebase/firestore: Firestore (5.5.0): The behavior for Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK. 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: const firestore = firebase.firestore(); const settings = {/* your settings... */ timestampsInSnapshots: true}; firestore.settings(settings); With this change, timestamps stored in Cloud Firestore will be read back as Firebase Timestamp objects instead of as system Date objects. So you will also need to update code expecting a Date to instead expect a Timestamp. For example: // Old: const date = snapshot.get('created_at'); // New: const timestamp = snapshot.get('created_at'); const date = timestamp.toDate(); Please audit all existing usages of Date when you enable the new behavior. In a future release, the behavior will change to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK. ```
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 6 6
Lines 85 85
Branches 18 18
=====================================
Hits 85 85
Continue to review full report at Codecov.
|
@CreativeGuy2013 - Thanks for taking the time to open a PR for this! Since this is opting into potentially breaking functionality, I would rather have the user pass in a prop that explicitly opts into this new behavior. Perhaps we could add a prop called Would you be open to updating this PR with that and adding a bit in the README in the Thanks again! |
Everything should work using |
@CreativeGuy2013 - Thanks again for the PR and for the quick updates on this! |
This message shows up now... added the fix as described.