Home > Software engineering >  How to fix this Error with Timestamp(Date()) in Kotlin
How to fix this Error with Timestamp(Date()) in Kotlin

Time:12-13

I am trying to use this code that I found on the firebase website enter image description here

Here are the imports I have for this :

import com.google.firebase.Timestamp
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.ktx.firestore
import com.google.firebase.ktx.Firebase
import com.google.type.Date

Any solutions to this would be greatly appreciated. I believe the error is aligned with the imports with Date.

CodePudding user response:

You have imported the wrong Date class. Your screenshot shows that you are using com.google.type.Date, but Firestore's Timestamp constructor only allows a java.util.Date type argument. Correct your imports and try again.

  • Related