Search code examples
angularfirebaseangularfire2angularfire

export 'Timestamp' (imported as 'Timestamp') was not found in > '@angular/fire/firestore


I have just upgrade my app from ionic 5 to 6 with

  1. angular 13 and
  2. angular/fire - 7.2.0
  3. firebase 9.6.3

same error coming in

FacebookAuthProvider OAuthProvider GoogleAuthProvider

and importing timestamp is causing issues with below error

Other than this all imports from '@angular/fire/firestore working well

export 'Timestamp' (imported as 'Timestamp') was not found in '@angular/fire/firestore' (possible exports: Firestore, FirestoreInstances, .......)

tried export 'firestore' (imported as 'firebase') was not found in 'firebase' after upgrading to firebase js sdk v8 but no luck


Solution

  • After Subscribing to a firebase stream You could convert any field with Timestamp type to date type: Let's suppose We have a document has a field named createdAt:

    const createdAt = new Date(createdAt.seconds * 1000 + createdAt.nanoseconds/1000000);