Skip to content

Commit ce013b1

Browse files
committed
fix: change firestore default settings version comparison
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 angular#2050
1 parent ce12956 commit ce013b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/firestore/firestore.ts

Lines changed: 3 additions & 1 deletion
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)