Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
173
rated 0 times [  176] [ 3]  / answers: 1 / hits: 6378  / 5 Years ago, sat, june 22, 2019, 12:00:00

Hi I'm new in web development and I'm trying to make a firebase app with the firestore database. I have a user registration form and in this form I need to get the date. For the date I used datepicker but I can't get the selected date and after transform it into firestore Timestamp. I tried this but I don't know if something is correct:

Html form:



<input class=datepicker type=text id=subscriptionDeadline placeholder=Subscription Deadline>


Javascript code:



  var currentDate = $(.subscriptionDeadline).datepicker(getDate);
var timeStamp = new firebase.firestore.Timestamp.fromDate(currentDate);


I get this error :




Uncaught TypeError: Cannot read property 'Timestamp' of undefined



More From » firebase

 Answers
4

Your error is Cannot read property 'Timestamp' of undefined. In the code, it is trying to access firebase.firestore.Timestamp.



The error is saying that whatever you are trying to read the property Timestamp from, is undefined. In your case it is firebase.firestore. If you do a console.log(firebase.firestore) it will show undefined, which means you won't be able to access the Timestamp property or anything else.



It sounds like the problem is you haven't initialized firestore properly on your page. Make sure you have followed these steps: https://cloud.google.com/firestore/docs/quickstart-mobile-web#set_up_your_development_environment


[#7178] Thursday, June 20, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raveno

Total Points: 453
Total Questions: 92
Total Answers: 92

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
raveno questions
;