-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(firestore): add toJSON() and valueOf() to FirestoreTimestamp #4439
Conversation
For parity with JS SDK, and also to make comparisons work as expected. Copied from https://github.com/firebase/firebase-js-sdk/blob/7c1c7f182b59e0fc7d175f53e5e2360cdee0ccab/packages/firestore/src/api/timestamp.ts#L162-L182. Please lmk if this is something you'd be interested in including, and I'd be happy to add a unit test
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/invertase/react-native-firebase/a1v1mzwb1 |
Codecov Report
@@ Coverage Diff @@
## master #4439 +/- ##
=======================================
Coverage 41.92% 41.92%
=======================================
Files 35 35
Lines 1119 1119
Branches 278 278
=======================================
Hits 469 469
Misses 489 489
Partials 161 161 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pokey 🏆 ! Sorry for the delay in reviewing this, there was one small lint error I corrected, but otherwise this looked great, I will merge this and do a release in an hour or so
Should FirestoreTimestamp include MIN_SECONDS for valueOf to work? |
@davidstott great catch! That's what we get for using javascript still instead of typescript 😞 The relevant lines we are missing are these https://github.com/firebase/firebase-js-sdk/blob/7c1c7f182b59e0fc7d175f53e5e2360cdee0ccab/packages/firestore/src/api/timestamp.ts#L21-L22 // The earlist date supported by Firestore timestamps (0001-01-01T00:00:00Z).
const MIN_SECONDS = -62135596800; I'll PR it quickly |
…vertase#4439) * Add toJSON() and valueOf() to FirestoreTimestamp For parity with JS SDK, and also to make comparisons work as expected. Copied from https://github.com/firebase/firebase-js-sdk/blob/7c1c7f182b59e0fc7d175f53e5e2360cdee0ccab/packages/firestore/src/api/timestamp.ts#L162-L182. Please lmk if this is something you'd be interested in including, and I'd be happy to add a unit test * Update packages/firestore/lib/FirestoreTimestamp.js Co-authored-by: Mike Hardy <github@mikehardy.net>
Description
For parity with JS SDK, and also to make comparisons work as expected. Copied from https://github.com/firebase/firebase-js-sdk/blob/7c1c7f182b59e0fc7d175f53e5e2360cdee0ccab/packages/firestore/src/api/timestamp.ts#L162-L182.
I just copied and pasted without testing or modification, so please lmk if this is something you'd be interested in including, and I'd be happy to add a unit test / clean / add type info to proper place
Related issues
Release Summary
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter