Skip to content

Commit d34bf2f

Browse files
ron4548jamesdaniels
authored andcommitted
fix(afs): Fix SDK version check (#2051)
Change the condition that determines whether timestampsInSnapshots setting is set to true. This is done to order to comply with multiple digits minor versions of firebase sdk. For example: version 5.10.0 is greater than 5.8.0 fixes #2050
1 parent ce12956 commit d34bf2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/firestore/firestore.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export const PersistenceSettingsToken = new InjectionToken<PersistenceSettings|u
1919
export const FirestoreSettingsToken = new InjectionToken<Settings>('angularfire2.firestore.settings');
2020

2121
// timestampsInSnapshots was depreciated in 5.8.0
22-
export const DefaultFirestoreSettings = (parseFloat(SDK_VERSION) < 5.8 ? {timestampsInSnapshots: true} : {}) as Settings;
22+
const major = parseInt(SDK_VERSION.split('.')[0]);
23+
const minor = parseInt(SDK_VERSION.split('.')[1]);
24+
export const DefaultFirestoreSettings = ((major < 5 || (major == 5 && minor < 8)) ? {timestampsInSnapshots: true} : {}) as Settings;
2325

2426
/**
2527
* A utility methods for associating a collection reference with

0 commit comments

Comments
 (0)