Adan Vivero
Adan Vivero

Reputation: 422

How to fix this Error with Timestamp(Date()) in Kotlin

I am trying to use this code that I found on the firebase website Here

Not only that, but other people are using Date() as part of their code and it gives me errors for some reason. Here is the error I am getting on my code.

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.

Upvotes: 0

Views: 386

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317808

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.

Upvotes: 1

Related Questions