2
I’m doing a show with Firestore of a record.
When the date is saved in the database, it is saved as Timestamp (For example: Timestamp(Seconds=149914800, nanoseconds=0)), but when I open the plug editing tab, the date comes in the form of Timestamp, soon I need to convert to a normal date, I searched the documentation of Firestore and saw the function toDate()
(that converts the Timestamp for a date), but when I went to use it, the console brings me the following error:
Uncaught (in Promise) Typeerror: data_nasc_.toDate is not a Function
I wanted to know how to solve it or else another way to make this conversion.
firebase.firestore().collection("usuario").doc(ocorrencia).get().then(usuario => {
data_nasc_ = usuario.data().Data_Nascimento.toDate();
}
good afternoon I forgot to see the answers, it turns out that the data was recorded in the database being a string and in it came as Timestamp(Seconds=149914800, nanoseconds=0), but it was not a real Firebase Timestamp, we changed how the date was recorded and worked toDate function normally
– lelis419