I got this error when trying to parse a timestamp from Firestore.
data class User(
val id: String,
val name: String,
val img: String,
val birth: Timestamp? = null
){
constructor() : this (
"",
"",
"",
)
}
I would like to parse the Firestore date to show the user's birthday.
CodePudding user response:
If you need to add a timestamp type field using an object of type User
, then you have to define the field in the class to be of type Date and use the annotation as below:
@ServerTimestamp
var birth: Date? = null
//